Skip to content

Commit ae1e714

Browse files
author
Filip Łukasik
committed
add floating button for mobile sidebar menu
1 parent 611a3db commit ae1e714

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

scaladoc/resources/dotty_res/scripts/ux.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ window.addEventListener("DOMContentLoaded", () => {
107107
})
108108

109109
// show/hide side menu on mobile view
110-
const sideMenuToggler = document.getElementById("mobile-menu-toggle");
110+
const sideMenuToggler = document.getElementById("mobile-sidebar-toggle");
111111
sideMenuToggler.addEventListener('click', _e => {
112112
document.getElementById("leftColumn").classList.toggle("show")
113113
sideMenuToggler.classList.toggle("menu-shown")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.floating-button {
2+
display: none;
3+
position: fixed;
4+
right: calc(6 * var(--base-spacing));
5+
bottom: calc(6 * var(--base-spacing));
6+
height: calc(5 * var(--base-spacing));
7+
width: calc(5 * var(--base-spacing));
8+
background-color: var(--action-primary-background-default-solid);
9+
box-shadow: 0px 10px 38px -10px var(--shadow-first),
10+
0px 10px 20px -15px var(--shadow-second),
11+
inset 0px 0px 0px 1px var(--shadow-inset);
12+
}
13+
14+
@media (max-width: 1024px) {
15+
.floating-button {
16+
display: block;
17+
}
18+
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@
5353
display: none;
5454
}
5555

56-
@media (max-width: 1024px) {
56+
@media (max-width: 768px) {
5757
#mobile-menu-toggle {
5858
margin-left: calc(3 * var(--base-spacing));
5959
display: block;
6060
}
61+
62+
.header-container-right .text-button {
63+
display: none;
64+
}
6165
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
244244
button(id := "mobile-menu-toggle", cls := "icon-button hamburger"),
245245
),
246246
),
247+
button(id := "mobile-sidebar-toggle", cls := "floating-button"),
247248
div(id := "leftColumn", cls := "body-small")(
248249
Seq(
249250
div(cls:= "switcher-container")(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ trait Resources(using ctx: DocContext) extends Locations, Writer:
108108
"styles/theme/layout/leftMenu.css",
109109
"styles/theme/layout/sideMenu.css",
110110
"styles/theme/layout/searchBar.css",
111+
"styles/theme/layout/floatingButton.css",
111112

112113
// components
113114
"styles/theme/components/switcher.css",

0 commit comments

Comments
 (0)