Skip to content

Commit 1be314d

Browse files
committed
Merge branch 'scaladoc-fixes' into dynamic-page-reload
2 parents 2489f1c + 7994b8f commit 1be314d

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
lines changed

scaladoc/resources/dotty_res/scripts/ux.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ sideMenuToggler.addEventListener('click', _e => {
161161
document.getElementById("leftColumn").classList.toggle("show")
162162
document.getElementById("content").classList.toggle("sidebar-shown")
163163
const toc = document.getElementById("toc");
164-
if (toc) {
164+
if (toc && toc.childElementCount > 0) {
165165
toc.classList.toggle("sidebar-shown")
166166
}
167167
sideMenuToggler.classList.toggle("menu-shown")

scaladoc/resources/dotty_res/styles/theme/components/code-snippet.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,15 @@
257257
background-color: var(--code-syntax-highlighting-scrollbar);
258258
opacity: 0.75;
259259
border-radius: 100px;
260+
border: 3px solid var(--action-primary-background-default-solid);
260261
}
261262

262263
.snippet::-webkit-scrollbar-thumb:hover {
263264
background-color: var(--code-syntax-highlighting-scrollbar-hover);
265+
border: 3px solid var(--action-primary-background-hover);;
264266
}
265267

266268
.snippet::-webkit-scrollbar {
267-
width: 8px;
268-
height: 8px;
269+
width: 12px;
270+
height: 12px;
269271
}

scaladoc/resources/dotty_res/styles/theme/components/navigation-item.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@
7777
max-width: calc(19 * var(--base-spacing));
7878
}
7979

80+
.n5 > .nh > .ar {
81+
left: calc(16.5 * var(--base-spacing));
82+
}
83+
84+
.n5 > .nh > a {
85+
left: calc(19.5 * var(--base-spacing));
86+
max-width: calc(16 * var(--base-spacing));
87+
}
88+
8089
.nh:hover {
8190
background: var(--action-primary-background-hover);
8291
cursor: pointer;

scaladoc/resources/dotty_res/styles/theme/components/pill.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
.pill .filter-name {
4444
color: var(--text-secondary);
4545
margin-right: calc(0.5 * var(--base-spacing));
46+
padding-bottom: 1px;
4647
}
4748

4849
.pill > .close {

scaladoc/resources/dotty_res/styles/theme/layout/content.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
color: var(--text-primary);
1111
}
1212

13+
#content > div:first-child {
14+
overflow: clip;
15+
}
16+
1317

1418
#content.sidebar-shown {
1519
-webkit-transition: width 0.3s ease-in-out;
@@ -188,7 +192,7 @@
188192
color: var(--code-props-content);
189193
font-family: "FiraCode-Regular";
190194
border: 1px solid var(--code-props-border);
191-
padding: 3px 6px;
195+
padding: 2px 5px;
192196
border-radius: 4px;
193197
background-color: var(--code-props-background);
194198
line-height: 24px;

scaladoc/resources/dotty_res/styles/theme/layout/searchBar.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
border-radius: 4px;
9494
margin-top: calc(1.5 * var(--base-spacing));
9595
border: 1px solid var(--border-default);
96+
max-height: calc(100vh - calc(19.5 * var(--base-spacing)));
97+
overflow: scroll;
9698
}
9799

98100
.searchbar-hints {
@@ -215,10 +217,8 @@
215217
}
216218

217219
.scaladoc-searchbar-row .micon {
218-
margin: calc(0.5 * var(--base-spacing)) calc(1 * var(--base-spacing)) 0px 0px;
220+
margin-right: calc(1 * var(--base-spacing));
219221
color: var(--text-secondary);
220-
position: relative;
221-
top: -2px;
222222
}
223223

224224
.scaladoc-searchbar-location {

scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
213213
div(cls := "breadcrumbs container")(innerTags:_*)
214214

215215
val (apiNavOpt, docsNavOpt): (Option[(Boolean, Seq[AppliedTag])], Option[(Boolean, Seq[AppliedTag])]) = buildNavigation(link)
216+
val isDocs = docsNavOpt match
217+
case Some(true, _) => true
218+
case _ => false
216219

217220
def textFooter: String | AppliedTag =
218221
args.projectFooter.fold("") { f =>
@@ -303,14 +306,16 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
303306
parentsHtml,
304307
div(id := "content", cls := "body-medium")(
305308
div(content),
306-
renderTableOfContents(toc).fold(Nil) { toc =>
309+
if isDocs then
307310
div(id := "toc", cls:="body-small")(
308-
div(id := "toc-container") (
309-
span(cls := "toc-title h200")("In this article"),
310-
toc
311-
),
312-
)
313-
},
311+
renderTableOfContents(toc).fold(Nil) { toc =>
312+
div(id := "toc-container")(
313+
span(cls := "toc-title h200")("In this article"),
314+
toc,
315+
)
316+
},
317+
)
318+
else Nil
314319
),
315320
div(id := "footer", cls := "body-small mobile-footer")(
316321
div(cls := "left-container")(

0 commit comments

Comments
 (0)