Skip to content

Commit 676178e

Browse files
committed
add mobile-menu
1 parent ae1e714 commit 676178e

File tree

19 files changed

+255
-8
lines changed

19 files changed

+255
-8
lines changed
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 1 addition & 1 deletion
Loading

scaladoc/resources/dotty_res/scripts/ux.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ window.addEventListener("DOMContentLoaded", () => {
112112
document.getElementById("leftColumn").classList.toggle("show")
113113
sideMenuToggler.classList.toggle("menu-shown")
114114
})
115+
116+
// show/hide mobile menu on mobile view
117+
const mobileMenuOpenIcon = document.getElementById("mobile-menu-toggle");
118+
const mobileMenuCloseIcon = document.getElementById("mobile-menu-close");
119+
mobileMenuOpenIcon.addEventListener('click', _e => {
120+
document.getElementById("mobile-menu").classList.add("show")
121+
})
122+
mobileMenuCloseIcon.addEventListener('click', _e => {
123+
document.getElementById("mobile-menu").classList.remove("show")
124+
})
115125
});
116126

117127
var zoom;

scaladoc/resources/dotty_res/styles/theme/colors.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@
157157
--orange12: #451e11;
158158

159159
/* shadow color */
160-
--shadow1: rgba(0, 0, 0, 0.6);
161-
--shadow2: rgba(0, 0, 0, 0.75);
160+
--shadow1: rgba(14, 18, 22, 0.2);
161+
--shadow2: rgba(14, 18, 22, 0.35);
162162
}
163163

164164
/*
165-
dakr theme
165+
dark theme
166166
*/
167167
:root.theme-dark {
168168
--grey1: #161618;
@@ -319,6 +319,6 @@
319319
--orange12: #feeadd;
320320

321321
/* shadow color */
322-
--shadow1: rgba(14, 18, 22, 0.2);
323-
--shadow2: rgba(14, 18, 22, 0.35);
322+
--shadow1: rgba(0, 0, 0, 0.6);
323+
--shadow2: rgba(0, 0, 0, 0.75);
324324
}

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

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,120 @@
11
.floating-button {
22
display: none;
33
position: fixed;
4-
right: calc(6 * var(--base-spacing));
5-
bottom: calc(6 * var(--base-spacing));
4+
right: calc(3 * var(--base-spacing));
5+
bottom: calc(3 * var(--base-spacing));
66
height: calc(5 * var(--base-spacing));
77
width: calc(5 * var(--base-spacing));
88
background-color: var(--action-primary-background-default-solid);
99
box-shadow: 0px 10px 38px -10px var(--shadow-first),
1010
0px 10px 20px -15px var(--shadow-second),
1111
inset 0px 0px 0px 1px var(--shadow-inset);
12+
border: none;
13+
border-radius: 4px;
14+
}
15+
16+
.floating-button:disabled {
17+
opacity: 0.5;
18+
}
19+
20+
.floating-button:focus-visible {
21+
box-shadow: 0px 0px 0px 2px var(--focus-default);
22+
}
23+
24+
#mobile-sidebar-toggle::after {
25+
content: url("../../../../images/icon-buttons/menu-animated/light/default.svg");
26+
}
27+
28+
#mobile-sidebar-toggle:hover::after {
29+
content: url("../../../../images/icon-buttons/menu-animated/light/hover.svg");
30+
}
31+
32+
#mobile-sidebar-toggle:active::after {
33+
content: url("../../../../images/icon-buttons/menu-animated/light/active.svg");
34+
}
35+
36+
#mobile-sidebar-toggle:disabled::after {
37+
content: url("../../../../images/icon-buttons/menu-animated/light/disabled.svg");
38+
}
39+
40+
#mobile-sidebar-toggle:focus::after {
41+
content: url("../../../../images/icon-buttons/menu-animated/light/focus.svg");
42+
}
43+
44+
#mobile-sidebar-toggle.selected::after {
45+
content: url("../../../../images/icon-buttons/menu-animated/light/selected.svg");
46+
}
47+
48+
.theme-dark #mobile-sidebar-toggle::after {
49+
content: url("../../../../images/icon-buttons/menu-animated/dark/default.svg");
50+
}
51+
52+
.theme-dark #mobile-sidebar-toggle:hover::after {
53+
content: url("../../../../images/icon-buttons/menu-animated/dark/hover.svg");
54+
}
55+
56+
.theme-dark #mobile-sidebar-toggle:active::after {
57+
content: url("../../../../images/icon-buttons/menu-animated/dark/active.svg");
58+
}
59+
60+
.theme-dark #mobile-sidebar-toggle:disabled::after {
61+
content: url("../../../../images/icon-buttons/menu-animated/dark/disabled.svg");
62+
}
63+
64+
.theme-dark #mobile-sidebar-toggle:focus::after {
65+
content: url("../../../../images/icon-buttons/menu-animated/dark/focus.svg");
66+
}
67+
68+
.theme-dark #mobile-sidebar-toggle.selected::after {
69+
content: url("../../../../images/icon-buttons/menu-animated/dark/selected.svg");
70+
}
71+
72+
#mobile-sidebar-toggle.menu-shown::after {
73+
content: url("../../../../images/icon-buttons/menu-animated-open/light/default.svg");
74+
}
75+
76+
#mobile-sidebar-toggle.menu-shown:hover::after {
77+
content: url("../../../../images/icon-buttons/menu-animated-open/light/hover.svg");
78+
}
79+
80+
#mobile-sidebar-toggle.menu-shown:active::after {
81+
content: url("../../../../images/icon-buttons/menu-animated-open/light/active.svg");
82+
}
83+
84+
#mobile-sidebar-toggle.menu-shown:disabled::after {
85+
content: url("../../../../images/icon-buttons/menu-animated-open/light/disabled.svg");
86+
}
87+
88+
#mobile-sidebar-toggle.menu-shown:focus::after {
89+
content: url("../../../../images/icon-buttons/menu-animated-open/light/focus.svg");
90+
}
91+
92+
#mobile-sidebar-toggle.menu-shown.selected::after {
93+
content: url("../../../../images/icon-buttons/menu-animated-open/light/selected.svg");
94+
}
95+
96+
.theme-dark #mobile-sidebar-toggle.menu-shown::after {
97+
content: url("../../../../images/icon-buttons/menu-animated-open/dark/default.svg");
98+
}
99+
100+
.theme-dark #mobile-sidebar-toggle.menu-shown:hover::after {
101+
content: url("../../../../images/icon-buttons/menu-animated-open/dark/hover.svg");
102+
}
103+
104+
.theme-dark #mobile-sidebar-toggle.menu-shown:active::after {
105+
content: url("../../../../images/icon-buttons/menu-animated-open/dark/active.svg");
106+
}
107+
108+
.theme-dark #mobile-sidebar-toggle.menu-shown:disabled::after {
109+
content: url("../../../../images/icon-buttons/menu-animated-open/dark/disabled.svg");
110+
}
111+
112+
.theme-dark #mobile-sidebar-toggle.menu-shown:focus::after {
113+
content: url("../../../../images/icon-buttons/menu-animated-open/dark/focus.svg");
114+
}
115+
116+
.theme-dark #mobile-sidebar-toggle.menu-shown.selected::after {
117+
content: url("../../../../images/icon-buttons/menu-animated-open/dark/selected.svg");
12118
}
13119

14120
@media (max-width: 1024px) {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#mobile-menu {
2+
display: none;
3+
position: absolute;
4+
background-color: var(--background-default);
5+
top: 0;
6+
left: 0;
7+
height: calc(100% - calc(6 * var(--base-spacing)));
8+
width: 100%;
9+
}
10+
11+
#mobile-menu.show {
12+
display: block;
13+
}
14+
15+
@media(min-width: 768px){
16+
#mobile-menu {
17+
display: none;
18+
}
19+
20+
#mobile-menu.show {
21+
display: none;
22+
}
23+
}
24+
25+
.mobile-menu-header {
26+
height: calc(8 * var(--base-spacing));
27+
border: 1px solid var(--border-default);
28+
display: flex;
29+
}
30+
31+
.mobile-menu-container {
32+
padding: calc(3 * var(--base-spacing));
33+
}
34+
35+
.mobile-menu-item {
36+
display: block;
37+
text-decoration: none;
38+
color: var(--action-primary-content-default);
39+
border-bottom: 1px solid var(--border-default);
40+
padding: calc(1.5 * var(--base-spacing)) calc(2 * var(--base-spacing));;
41+
}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,35 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
244244
button(id := "mobile-menu-toggle", cls := "icon-button hamburger"),
245245
),
246246
),
247+
div(id := "mobile-menu")(
248+
div(cls := "mobile-menu-header")(
249+
span(cls := "mobile-menu-logo"),
250+
button(id := "mobile-menu-close", cls := "icon-button close"),
251+
),
252+
div(cls := "mobile-menu-container body-medium")(
253+
a(href := "https://www.scala-lang.org/download/", cls := "mobile-menu-item") (
254+
"Download",
255+
),
256+
a(href := "https://docs.scala-lang.org/", cls := "mobile-menu-item") (
257+
"Documentation",
258+
),
259+
a(href := "https://index.scala-lang.org", cls := "mobile-menu-item") (
260+
"Libraries",
261+
),
262+
a(href := "https://www.scala-lang.org/contribute/", cls := "mobile-menu-item") (
263+
"Contribute",
264+
),
265+
a(href := "https://www.scala-lang.org/contribute/", cls := "mobile-menu-item") (
266+
"Blog",
267+
),
268+
a(href := "https://www.scala-lang.org/blog/", cls := "mobile-menu-item") (
269+
"Community",
270+
),
271+
span(cls := "mobile-menu-item") (
272+
"Light mode"
273+
)
274+
)
275+
),
247276
button(id := "mobile-sidebar-toggle", cls := "floating-button"),
248277
div(id := "leftColumn", cls := "body-small")(
249278
Seq(

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ trait Resources(using ctx: DocContext) extends Locations, Writer:
109109
"styles/theme/layout/sideMenu.css",
110110
"styles/theme/layout/searchBar.css",
111111
"styles/theme/layout/floatingButton.css",
112+
"styles/theme/layout/mobileMenu.css",
112113

113114
// components
114115
"styles/theme/components/switcher.css",
@@ -353,6 +354,18 @@ trait Resources(using ctx: DocContext) extends Locations, Writer:
353354
dottyRes("images/icon-buttons/menu-animated/light/hover.svg"),
354355
dottyRes("images/icon-buttons/menu-animated/light/selected.svg"),
355356
dottyRes("images/icon-buttons/menu-animated/light/default.svg"),
357+
dottyRes("images/icon-buttons/menu-animated-open/dark/active.svg"),
358+
dottyRes("images/icon-buttons/menu-animated-open/dark/disabled.svg"),
359+
dottyRes("images/icon-buttons/menu-animated-open/dark/focus.svg"),
360+
dottyRes("images/icon-buttons/menu-animated-open/dark/hover.svg"),
361+
dottyRes("images/icon-buttons/menu-animated-open/dark/selected.svg"),
362+
dottyRes("images/icon-buttons/menu-animated-open/dark/default.svg"),
363+
dottyRes("images/icon-buttons/menu-animated-open/light/active.svg"),
364+
dottyRes("images/icon-buttons/menu-animated-open/light/disabled.svg"),
365+
dottyRes("images/icon-buttons/menu-animated-open/light/focus.svg"),
366+
dottyRes("images/icon-buttons/menu-animated-open/light/hover.svg"),
367+
dottyRes("images/icon-buttons/menu-animated-open/light/selected.svg"),
368+
dottyRes("images/icon-buttons/menu-animated-open/light/default.svg"),
356369
searchData(pages),
357370
scastieConfiguration(),
358371
)

0 commit comments

Comments
 (0)