Skip to content

Commit 51120be

Browse files
KacperFKorbanpikinier20
authored andcommitted
Apply review suggestions from PR #11822
1 parent cd281e7 commit 51120be

File tree

4 files changed

+58
-13
lines changed

4 files changed

+58
-13
lines changed

scaladoc-js/resources/scaladoc-searchbar.css

+24-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,29 @@
103103
margin-left: auto;
104104
}
105105

106-
.hide-snippet-comments-button {
106+
.snippet-comment-button {
107107
position: absolute;
108-
left: 90%;
108+
left: 50%;
109+
width: 24px;
110+
height: 24px;
111+
}
112+
113+
.show-snippet-comments-button {
114+
-ms-transform: translate(calc(-50% + 5em), -50%);
115+
transform: translate(calc(-50% + 5em), -50%);
116+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Ccircle cx='12' cy='12' r='12' fill='white'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19 11.0053L19 13.1085H12.9873L12.988 19H10.8714L10.8721 13.1085L5 13.1085L5 11.0053L10.8721 11.0053V5L12.9865 5.00074L12.988 11.0045L19 11.0053Z' fill='%2327282C' fill-opacity='0.75'/%3E %3C/svg%3E");
117+
}
118+
119+
.show-snippet-comments-button:hover {
120+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Ccircle cx='12' cy='12' r='12' fill='light grey'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19 11.0053L19 13.1085H12.9873L12.988 19H10.8714L10.8721 13.1085L5 13.1085L5 11.0053L10.8721 11.0053V5L12.9865 5.00074L12.988 11.0045L19 11.0053Z' fill='%2327282C' fill-opacity='0.75'/%3E %3C/svg%3E");
121+
}
122+
123+
.hide-snippet-comments-button {
124+
-ms-transform: translate(calc(-50% + 5em), -50%) rotate(45deg);
125+
transform: translate(calc(-50% + 5em), -50%) rotate(45deg);
126+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Ccircle cx='12' cy='12' r='12' fill='white'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19 11.0053L19 13.1085H12.9873L12.988 19H10.8714L10.8721 13.1085L5 13.1085L5 11.0053L10.8721 11.0053V5L12.9865 5.00074L12.988 11.0045L19 11.0053Z' fill='%2327282C' fill-opacity='0.75'/%3E %3C/svg%3E");
127+
}
128+
129+
.hide-snippet-comments-button:hover {
130+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Ccircle cx='12' cy='12' r='12' fill='light grey'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19 11.0053L19 13.1085H12.9873L12.988 19H10.8714L10.8721 13.1085L5 13.1085L5 11.0053L10.8721 11.0053V5L12.9865 5.00074L12.988 11.0045L19 11.0053Z' fill='%2327282C' fill-opacity='0.75'/%3E %3C/svg%3E");
109131
}

scaladoc-js/src/searchbar/code-snippets/CodeSnippets.scala

+10-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@ class CodeSnippets:
2525
toggleHide(document)
2626

2727
document.querySelectorAll("pre").foreach {
28-
case e: html.Element =>
28+
case e: html.Element if e.querySelectorAll("code span.hideable").nonEmpty =>
2929
val a = document.createElement("a")
30-
a.textContent = "Show"
3130
a.addEventListener("click", { (_: MouseEvent) =>
32-
a.textContent = if a.textContent == "Show" then "Hide" else "Show"
31+
if(a.classList.contains("hide-snippet-comments-button")) {
32+
a.classList.add("show-snippet-comments-button")
33+
a.classList.remove("hide-snippet-comments-button")
34+
} else {
35+
a.classList.add("hide-snippet-comments-button")
36+
a.classList.remove("show-snippet-comments-button")
37+
}
3338
toggleHide(e)
3439
})
35-
a.classList.add("hide-snippet-comments-button")
40+
a.classList.add("snippet-comment-button")
41+
a.classList.add("show-snippet-comments-button")
3642
e.insertBefore(a, e.firstChild)
3743
}

scaladoc-testcases/src/tests/snippetComments.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package tests.snippetComments
1616
* /*
1717
* multi line comment
1818
* */
19-
*
19+
* val reallyFLongDeclaration = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
2020
* val y = 2 // comment in the same line
2121
* // comment in new line
2222
* val z = 3

scaladoc/resources/dotty_res/styles/scalastyle.css

+23-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
--border-light: #DADFE6;
66
--border-medium: #abc;
77

8+
--body-bg: #f0f3f6;
89
--code-bg: #F4F5FA;
10+
--documentable-bg: #FFFFFF;
911
--symbol-fg: #333;
1012
--link-fg: #00607D;
1113
--link-hover-fg: #00A0D0;
@@ -45,6 +47,7 @@ body {
4547
padding: 0;
4648
font-family: "Lato", sans-serif;
4749
font-size: 16px;
50+
background-color: var(--body-bg);
4851
}
4952

5053
/* Page layout */
@@ -75,7 +78,12 @@ h1, h2, h3 {
7578
font-family: var(--title-font);
7679
color: var(--title-fg);
7780
}
78-
pre, code, .monospace, .hljs {
81+
.monospace {
82+
font-family: var(--mono-font);
83+
background: var(--documentable-bg);
84+
font-variant-ligatures: none;
85+
}
86+
pre, code, .hljs {
7987
font-family: var(--mono-font);
8088
background: var(--code-bg);
8189
font-variant-ligatures: none;
@@ -84,12 +92,16 @@ code {
8492
font-size: .8em;
8593
padding: 0 .3em;
8694
}
95+
pre {
96+
overflow-x: auto;
97+
scrollbar-width: thin;
98+
}
8799
pre code, pre code.hljs {
88100
font-size: 1em;
89101
padding: 0;
90102
}
91103
pre, .symbol.monospace {
92-
padding: 10px 8px 10px 12px;
104+
padding: 12px 8px 10px 12px;
93105
font-weight: 500;
94106
font-size: 12px;
95107
}
@@ -468,12 +480,18 @@ footer .pull-right {
468480
padding-right: 0.5em;
469481
min-width: 10em;
470482
max-width: 10em;
483+
width: 10em;
471484
overflow: hidden;
472485
direction: rtl;
473486
white-space: nowrap;
474487
text-indent: 0em;
475488
}
476489

490+
.documentableElement .docs {
491+
width: 100%;
492+
table-layout: fixed;
493+
}
494+
477495
.documentableElement .modifiers .other-modifiers {
478496
color: gray;
479497
}
@@ -514,8 +532,8 @@ footer .pull-right {
514532
padding: 5px 4px 5px 4px;
515533
font-weight: 500;
516534
font-size: 12px;
517-
background: var(--code-bg);
518-
border: 0.25em solid white;
535+
background: var(--documentable-bg);
536+
border: 0.25em solid var(--body-bg);
519537
}
520538

521539
.documentableElement>div {
@@ -524,12 +542,11 @@ footer .pull-right {
524542

525543
.expand.documentableElement>div {
526544
display: block;
527-
padding-left: 3em;
528545
}
529546

530547
.expand.documentableElement>div.header {
531548
display: block;
532-
padding-left: 7.5em;
549+
padding-left: 4.5em;
533550
text-indent: -4.5em;
534551
}
535552

0 commit comments

Comments
 (0)