Skip to content

Scaladoc: Icons for searchbar results #12595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions scaladoc-js/resources/scaladoc-searchbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@

.scaladoc-searchbar-result {
background: white;
line-height: 32px;
padding-left: 10px;
padding-right: 10px;
line-height: 24px;
display: flex;
padding: 4px 10px 4px 10px;
}

.scaladoc-searchbar-result .micon {
height: 16px;
width: 16px;
margin: 4px 8px 0px 0px;
}

.scaladoc-searchbar-result:first-of-type {
Expand All @@ -88,6 +94,8 @@

.scaladoc-searchbar-result a {
color: #1f2326;
text-indent: -20px;
padding-left: 20px;
}

.scaladoc-searchbar-result .scaladoc-searchbar-location {
Expand Down
3 changes: 3 additions & 0 deletions scaladoc-js/src/searchbar/PageEntry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ trait PageEntryJS extends js.Object {
val t: String = js.native
val d: String = js.native
val l: String = js.native
val k: String = js.native
}

case class PageEntry(
fullName: String,
description: String,
location: String,
shortName: String,
kind: String,
tokens: List[String]
)

Expand All @@ -24,6 +26,7 @@ object PageEntry {
jsObj.d,
jsObj.l,
jsObj.n.toLowerCase,
jsObj.k,
StringUtils.createCamelCaseTokens(jsObj.n)
)
}
5 changes: 5 additions & 0 deletions scaladoc-js/src/searchbar/SearchbarComponent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class SearchbarComponent(val callback: (String) => List[PageEntry]):
wrapper.classList.add("scaladoc-searchbar-result")
wrapper.classList.add("monospace")

val icon = document.createElement("span").asInstanceOf[html.Span]
icon.classList.add("micon")
icon.classList.add(p.kind.take(2))

val resultA = document.createElement("a").asInstanceOf[html.Anchor]
resultA.href = Globals.pathToRoot + p.location
resultA.text = s"${p.fullName}"
Expand All @@ -20,6 +24,7 @@ class SearchbarComponent(val callback: (String) => List[PageEntry]):
location.classList.add("scaladoc-searchbar-location")
location.textContent = p.description

wrapper.appendChild(icon)
wrapper.appendChild(resultA)
wrapper.appendChild(location)
wrapper.addEventListener("mouseover", {
Expand Down
1 change: 1 addition & 0 deletions scaladoc-js/test/dotty/dokka/MatchersTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MatchersTest:
"",
"",
s"$name",
kind,
StringUtils.createCamelCaseTokens(name)
)

Expand Down
286 changes: 46 additions & 240 deletions scaladoc/resources/dotty_res/images/enum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading