Skip to content

Commit acaf670

Browse files
committed
fix smaller resolution search footer, add search input to mobile menu
1 parent b1eb113 commit acaf670

File tree

5 files changed

+62
-9
lines changed

5 files changed

+62
-9
lines changed

scaladoc-js/main/src/searchbar/SearchbarComponent.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class SearchbarComponent(engine: SearchbarEngine, inkuireEngine: InkuireJSSearch
202202
icon
203203

204204
private val inputElem: html.Input =
205-
input(id := "scaladoc-searchbar-input", `type` := "search", `placeholder`:= "Find anything").tap { element =>
205+
input(cls := "scaladoc-searchbar-input", `type` := "search", `placeholder`:= "Find anything").tap { element =>
206206
element.addEventListener("input", { e =>
207207
clearTimeout(timeoutHandle)
208208
val inputValue = e.target.asInstanceOf[html.Input].value

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,18 @@
8383
.header-container-right .text-button {
8484
display: none;
8585
}
86+
87+
#theme-toggle {
88+
display: none;
89+
}
90+
91+
#search-toggle {
92+
display: none;
93+
}
8694
}
8795

8896
@media (max-width: 500px) {
8997
.projectVersion {
9098
width: calc(6 * var(--base-spacing));
9199
}
92-
93100
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,12 @@
195195

196196
.theme-dark #mobile-menu-close.selected::after {
197197
content: url("../../../../images/icon-buttons/close/dark/selected.svg");
198+
}
199+
200+
/* search */
201+
202+
#mobile-scaladoc-searchbar-input {
203+
height: calc(4.5 * var(--base-spacing));
204+
background-position: 10px 10px;
205+
margin-bottom: calc(1.5 * var(--base-spacing));;
198206
}

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

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,25 @@
1515
top: calc(3 * var(--base-spacing));
1616
}
1717

18-
#scaladoc-searchbar-input {
18+
@media(max-width: 1024px) {
19+
#scaladoc-searchbar {
20+
width: calc(100 * var(--base-spacing));
21+
}
22+
}
23+
24+
@media(max-width: 825px) {
25+
#scaladoc-searchbar {
26+
width: calc(80 * var(--base-spacing));
27+
}
28+
}
29+
30+
@media(max-width: 768px) {
31+
#searchbar-container {
32+
display: none;
33+
}
34+
}
35+
36+
.scaladoc-searchbar-input {
1937
width: 100%;
2038
background-color: var(--action-primary-background-default-solid);
2139
color: var(--action-primary-content-active);
@@ -29,12 +47,12 @@
2947
border: none;
3048
}
3149

32-
#scaladoc-searchbar-input:focus-visible {
50+
.scaladoc-searchbar-input:focus-visible {
3351
border: none;
3452
outline: none;
3553
}
3654

37-
#scaladoc-searchbar-input::-webkit-search-cancel-button {
55+
.scaladoc-searchbar-input::-webkit-search-cancel-button {
3856
-webkit-appearance: none;
3957
height: 1em;
4058
width: 1em;
@@ -45,17 +63,17 @@
4563
pointer-events: none;
4664
}
4765

48-
.theme-dark #scaladoc-searchbar-input::-webkit-search-cancel-button {
66+
.theme-dark .scaladoc-searchbar-input::-webkit-search-cancel-button {
4967
background: url("../../../images/icon-buttons/close/dark/default.svg")
5068
no-repeat 50% 50%;
5169
}
5270

53-
#scaladoc-searchbar-input:focus::-webkit-search-cancel-button {
71+
.scaladoc-searchbar-input:focus::-webkit-search-cancel-button {
5472
opacity: 1;
5573
pointer-events: all;
5674
}
5775

58-
#scaladoc-searchbar-input.dark::-webkit-search-cancel-button {
76+
.scaladoc-searchbar-input.dark::-webkit-search-cancel-button {
5977
filter: invert(1);
6078
}
6179

@@ -208,3 +226,22 @@
208226
.searchbar-footer-right-container {
209227
margin-left: auto;
210228
}
229+
230+
@media(max-width: 892px) {
231+
#searchbar-footer {
232+
height: calc(10 * var(--base-spacing));
233+
}
234+
235+
#searchbar-footer span {
236+
display: block;
237+
}
238+
239+
.searchbar-footer-left-container span:not(:first-child) {
240+
margin-left: calc(2 * var(--base-spacing));
241+
margin-top: calc(1 * var(--base-spacing));
242+
}
243+
244+
.searchbar-footer-right-container span:not(:first-child) {
245+
margin-top: calc(1 * var(--base-spacing));
246+
}
247+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
221221
div(id := "version-dropdown", cls := "dropdown-menu") ()
222222
),
223223
div(cls:="header-container-right")(
224-
button(id := "search-toggle", cls := "icon-button"),
224+
button(id := "search-toggle", cls := "icon-button"),
225225
a(href := "https://www.scala-lang.org/download/", cls := "text-button") (
226226
"Download",
227227
),
@@ -253,6 +253,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
253253
button(id := "mobile-menu-close", cls := "icon-button close"),
254254
),
255255
div(cls := "mobile-menu-container body-medium")(
256+
input(id := "mobile-scaladoc-searchbar-input", cls := "scaladoc-searchbar-input", `type` := "search", `placeholder`:= "Search documentation"),
256257
a(href := "https://www.scala-lang.org/download/", cls := "mobile-menu-item") (
257258
"Download",
258259
),

0 commit comments

Comments
 (0)