Skip to content

Commit 2b2396b

Browse files
committed
add table of content compoenent
1 parent ce2b92e commit 2b2396b

File tree

8 files changed

+93
-10
lines changed

8 files changed

+93
-10
lines changed

docs/_layouts/static-site-main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: main
33
---
44

5-
<div class="container">
5+
<div class="site-container">
66
<div id="site-header"></div>
77
{% if page.movedTo %}
88
<aside class="warning">

scaladoc/resources/dotty_res/styles/scalastyle.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ footer .socials {
929929
height: 8px;
930930
}
931931

932-
#toc {
932+
/* #toc {
933933
display: inline;
934934
position: fixed;
935935
right: 0px;
@@ -968,7 +968,7 @@ footer .socials {
968968
969969
#toc li.active > a {
970970
color: var(--link-hover-fg);
971-
}
971+
} */
972972

973973
/* Signature coloring */
974974

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#toc {
2+
display: flex;
3+
flex-direction: column;
4+
margin-top: calc(18.75 * var(--base-spacing));
5+
margin-right: calc(36.75 * var(--base-spacing));
6+
}
7+
8+
#toc ul {
9+
list-style-type: none;
10+
padding: 0;
11+
}
12+
13+
#toc li {
14+
margin-bottom: calc(2.5 * var(--base-spacing));
15+
}
16+
17+
@media(max-width: 1366px) {
18+
#toc {
19+
margin-right: calc(6 * var(--base-spacing));
20+
}
21+
}
22+
23+
@media(max-width: 1366px) {
24+
#toc {
25+
margin-right: calc(6 * var(--base-spacing));
26+
}
27+
}
28+
29+
@media(max-width: 768px) {
30+
#toc {
31+
display: none;
32+
}
33+
}
34+
35+
.toc-title {
36+
color: var(--text-primary);
37+
margin-bottom: calc(2 * var(--base-spacing));
38+
}
39+
40+
.toc-nav a{
41+
color: var(--action-primary-content-default);
42+
text-decoration: none;
43+
}
44+
45+
#toc li:hover > a {
46+
color: var(--action-primary-content-hover);
47+
}
48+
49+
#toc li:active > a {
50+
color: var(--action-primary-content-hover);
51+
}
52+
53+
#toc li.selected > a {
54+
color: var(--action-primary-content-selected);
55+
}
56+
57+
#toc li:focus-visible {
58+
box-shadow: 0px 0px 0px 2px var(--focus-default);
59+
}

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,36 @@
22
height: 100%;
33
width: calc(100% - calc(39 * var(--base-spacing)));
44
float: right;
5-
overflow: scroll;
65
margin-top: var(--header-height);
76
display: flex;
7+
margin-left: calc(36.75 * var(--base-spacing));
88
}
99

1010
#content-wrapper {
11+
margin-left: calc(36,75 * var(--base-spacing));
12+
margin-right: calc(9.5 * var(--base-spacing));
13+
overflow: scroll;
14+
}
15+
16+
@media(max-width: 1365px) {
17+
#content-wrapper {
18+
margin-left: calc(6 * var(--base-spacing));
19+
margin-right: calc(7 * var(--base-spacing));
20+
}
21+
}
22+
23+
@media(max-width: 768px) {
24+
#content-wrapper {
25+
margin-right: calc(6 * var(--base-spacing));
26+
}
27+
}
28+
1129

30+
@media(max-width: 390px) {
31+
#content-wrapper {
32+
margin-left: calc(4 * var(--base-spacing));
33+
margin-right: calc(4 * var(--base-spacing));
34+
}
1235
}
1336

1437
#content h1 {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
padding: calc(3 * var(--base-spacing)) 0px;
66
position: absolute;
77
width: calc(39 * var(--base-spacing));
8-
height: calc(100% - var(--header-height) - (6 * var(--base-spacing)));
8+
height: calc(100% - (8 * var(--base-spacing)) - (6 * var(--base-spacing)));
99
left: 0px;
1010
top: calc(8 * var(--base-spacing));
1111
background: var(--background-default);
@@ -17,7 +17,7 @@
1717

1818
@media (max-width: 480px) {
1919
#leftColumn {
20-
height: calc(100% - var(--header-height) - (9 * var(--base-spacing)));
20+
height: calc(100% - (8 * var(--base-spacing)) - (9 * var(--base-spacing)));
2121
}
2222
}
2323

@@ -33,7 +33,7 @@
3333

3434
@media (max-width: 390px) {
3535
#leftColumn {
36-
height: calc(100% - var(--header-height));
36+
height: calc(100% - (8 * var(--base-spacing)));
3737
width: 100%;
3838
left: -100%;
3939
z-index: 1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.side-menu {
2-
overflow-y: auto;
2+
overflow-y: scroll;
33
overflow-x: hidden;
44
width: 100%;
55
height: calc(100% - calc(11 * var(--base-spacing)));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
328328
div(id := "content")(
329329
content.content,
330330
renderTableOfContents(content.toc).fold(Nil) { toc =>
331-
div(id := "toc")(
332-
span(cls := "toc-title")("In this article"),
331+
div(id := "toc", cls:="body-small")(
332+
span(cls := "toc-title h200")("In this article"),
333333
toc
334334
)
335335
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ trait Resources(using ctx: DocContext) extends Locations, Writer:
120120
"styles/theme/components/button/text-button.css",
121121
"styles/theme/components/dropdown-menu.css",
122122
"styles/theme/components/divider.css",
123+
"styles/theme/components/table-of-content.css",
123124

124125
"styles/nord-light.css",
125126
"styles/dotty-icons.css",

0 commit comments

Comments
 (0)