Skip to content

Commit 6382877

Browse files
author
Filip Łukasik
committed
add searchbar footer
1 parent 19b4034 commit 6382877

File tree

6 files changed

+77
-89
lines changed

6 files changed

+77
-89
lines changed

scaladoc-js/common/css/searchbar.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,32 +213,32 @@ div[selected] > .scaladoc-searchbar-inkuire-package {
213213
overflow: auto;
214214
} */
215215

216-
.scaladoc-searchbar-row {
216+
/* .scaladoc-searchbar-row {
217217
display: flex;
218218
background-color: var(--leftbar-bg);
219219
color: var(--leftbar-fg);
220220
line-height: 24px;
221221
padding: 4px 10px 4px 10px;
222-
}
222+
} */
223223

224224
.scaladoc-searchbar-row.hidden {
225225
display: none;
226226
}
227227

228-
.scaladoc-searchbar-row[divider] {
228+
/* .scaladoc-searchbar-row[divider] {
229229
border-top: solid 1px var(--leftbar-border);
230-
}
230+
} */
231231

232232
.scaladoc-searchbar-row .micon {
233233
height: 16px;
234234
width: 16px;
235235
margin: 4px 8px 0px 0px;
236236
}
237237

238-
.scaladoc-searchbar-row[selected] {
238+
/* .scaladoc-searchbar-row[selected] {
239239
background-color: var(--leftbar-hover-bg);
240240
color: var(--leftbar-hover-fg);
241-
}
241+
} */
242242

243243
.scaladoc-searchbar-row[result] {
244244
flex-direction: column;

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class SearchbarComponent(engine: SearchbarEngine, inkuireEngine: InkuireJSSearch
172172
icon
173173

174174
private val inputElem: html.Input =
175-
input(id := "scaladoc-searchbar-input", `type` := "search").tap { element =>
175+
input(id := "scaladoc-searchbar-input", `type` := "search", `placeholder`:= "Find anything").tap { element =>
176176
element.addEventListener("input", { e =>
177177
val inputValue = e.target.asInstanceOf[html.Input].value
178178
if inputValue.isEmpty then showHints()
@@ -203,8 +203,22 @@ class SearchbarComponent(engine: SearchbarEngine, inkuireEngine: InkuireJSSearch
203203
})
204204
}
205205

206+
val searchbarFooter = div(id := "searchbar-footer", cls := "body-small")(
207+
span(cls := "searchbar-footer-left-container")(
208+
span("Smart search:"),
209+
span(b("CC "), "to find CamcelCase phrases"),
210+
span(b("A=>B "), "to find CamcelCase signatures"),
211+
),
212+
span(cls := "searchbar-footer-right-container")(
213+
span(b("Esc "), "to close"),
214+
span(b("Arrows "), "to navigate"),
215+
span(b("Enter "), "to select"),
216+
),
217+
)
218+
206219
val rootParent = div(id := "searchbar-container")(
207-
element
220+
element,
221+
searchbarFooter
208222
).tap { rootElem =>
209223
rootElem.addEventListener("mousedown", (e: Event) => handleEscape())
210224
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
}
163163

164164
/*
165-
Light theme
165+
dakr theme
166166
*/
167167
:root.theme-dark {
168168
--grey1: #161618;
@@ -176,7 +176,7 @@
176176
--grey9: #706f78;
177177
--grey10: #7e7d86;
178178
--grey11: #a09fa6;
179-
--grey12: #ededef;
179+
--grey12: #cccccc;
180180

181181
/* red colors */
182182
--red1: #1f1315;

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

Lines changed: 1 addition & 1 deletion
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));
8+
height: calc(100% - var(--header-height) - (5 * var(--base-spacing)));
99
left: 0px;
1010
top: calc(8 * var(--base-spacing));
1111
background: var(--background-default);

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#scaladoc-searchbar {
1212
z-index: 5;
1313
width: calc(125 * var(--base-spacing));
14+
position: relative;
15+
top: calc(3 * var(--base-spacing));
1416
}
1517

1618
#scaladoc-searchbar-input {
@@ -61,6 +63,9 @@
6163
background-color: var(--background-default);
6264
border-radius: 4px;
6365
margin-top: calc(1.5 * var(--base-spacing));
66+
border: 1px solid var(--border-default);
67+
max-height: calc(100% - calc(24 * var(--base-spacing)));
68+
overflow: scroll;
6469
}
6570

6671
.searchbar-hints {
@@ -146,3 +151,50 @@
146151
.searchbar-hints-list .h100:last-of-type {
147152
margin-top: calc(6 * var(--base-spacing));
148153
}
154+
155+
.scaladoc-searchbar-row {
156+
display: flex;
157+
color: var(--text-secondary);
158+
padding: calc(2 * var(--base-spacing)) calc(2 * var(--base-spacing));
159+
}
160+
161+
.scaladoc-searchbar-row[divider] {
162+
border-top: solid 1px var(--border-default);
163+
}
164+
165+
.scaladoc-searchbar-row a {
166+
color: var(--text-secondary);
167+
text-decoration: none;
168+
}
169+
170+
/* searchbar footer */
171+
#searchbar-footer {
172+
position: absolute;
173+
bottom: 0px;
174+
background-color: var(--background-default);
175+
color: var(--text-secondary);
176+
height: calc(6 * var(--base-spacing));
177+
width: 100%;
178+
display: flex;
179+
align-items: center;
180+
}
181+
182+
#searchbar-footer b {
183+
color: var(--text-primary);
184+
}
185+
186+
.searchbar-footer-right-container span {
187+
margin-right: calc(2 * var(--base-spacing));
188+
}
189+
190+
.searchbar-footer-left-container span {
191+
margin-right: calc(2 * var(--base-spacing));
192+
}
193+
194+
.searchbar-footer-left-container span:first-of-type {
195+
margin-left: calc(2 * var(--base-spacing));
196+
}
197+
198+
.searchbar-footer-right-container {
199+
margin-left: auto;
200+
}

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

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -242,47 +242,8 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
242242
),
243243
button(id := "theme-toggle", cls := "icon-button"),
244244
),
245-
246-
247-
// div(id := "logo")(
248-
// projectLogo,
249-
// span(
250-
// div(cls:="projectName")(args.name)
251-
// ),
252-
// div(id := "version")(
253-
// div(cls := "versions-dropdown")(
254-
// div(onclick := "dropdownHandler()", id := "dropdown-button", cls := "dropdownbtn dropdownbtnactive")(
255-
// args.projectVersion.map(v => div(cls:="projectVersion")(v)).getOrElse(""),
256-
// div(id := "dropdown-content", cls := "dropdown-content")(
257-
// input(`type` := "text", placeholder := "Search...", id := "dropdown-input", onkeyup := "filterFunction()"),
258-
// ),
259-
// ),
260-
// )
261-
// ),
262-
// div(cls := "socials")(
263-
// socialLinks()
264-
// )
265-
// ),
266-
// div(id := "paneSearch"),
267-
// div(cls := "mode")(
268-
// span(cls :="footer-text")(raw("Mode")),
269-
// label(id := "theme-toggle", cls := "switch")(
270-
// input(`type` := "checkbox"),
271-
// span(cls := "slider")
272-
// )
273-
// ),
274245
),
275246
div(id := "leftColumn", cls := "body-small")(
276-
// div(id := "logo")(
277-
// projectLogo,
278-
// span(
279-
// div(cls:="projectName")(args.name)
280-
// ),
281-
// div(cls := "socials")(
282-
// socialLinks()
283-
// )
284-
// ),
285-
// div(id := "paneSearch"),
286247
Seq(
287248
div(cls:= "switcher-container")(
288249
apiNavOpt match {
@@ -308,45 +269,6 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
308269
span(cls := "icon-toggler")
309270
),
310271
div(id := "scaladoc-searchBar"),
311-
// main(id := "main-content")(
312-
// parentsHtml,
313-
// div(id := "content")(content),
314-
// ),
315-
footer(
316-
// div(id := "generated-by")(
317-
// span(cls := "footer-text")(raw("Generated by")),
318-
// a(href := "https://github.com/lampepfl/dotty/tree/master/scaladoc")(
319-
// img(
320-
// src := resolveRoot(link.dri, "images/scaladoc_logo.svg"),
321-
// alt := "scaladoc",
322-
// cls := "scaladoc_logo"
323-
// ),
324-
// img(
325-
// src := resolveRoot(link.dri, "images/scaladoc_logo_dark.svg"),
326-
// alt := "scaladoc",
327-
// cls := "scaladoc_logo_dark"
328-
// )
329-
// )
330-
// ),
331-
// textFooter,
332-
// div(cls := "socials")(
333-
// span(cls := "footer-text")(if hasSocialLinks then Seq(raw("Social links")) else Nil),
334-
// socialLinks(whiteIcon = false)
335-
// ),
336-
div(cls := "mode")(
337-
span(cls :="footer-text")(raw("Mode")),
338-
label(id := "theme-toggle", cls := "switch")(
339-
input(`type` := "checkbox"),
340-
span(cls := "slider")
341-
)
342-
),
343-
// span(cls := "go-to-top-icon")(
344-
// a(href := "#container")(
345-
// span(cls:="icon-vertical_align_top"),
346-
// span(cls :="footer-text")(raw("Back to top"))
347-
// )
348-
// )
349-
)
350272
),
351273
renderTableOfContents(content.toc).fold(Nil) { toc =>
352274
div(id := "toc")(

0 commit comments

Comments
 (0)