-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Scaladoc: Grouping entries in searchbar. Add hints to searchbar #14539
Scaladoc: Grouping entries in searchbar. Add hints to searchbar #14539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styling comments:
- add some horizontal padding
- add shadow to the border to make it stand out more (right now it blends with the background)
- show more button should... show more records, right now you have to click it a lot of times. Also this poses a little UX question: should this search also have a more expanded version to accommodate rows from "Show more"?
On a totally unrelated note i think that having the same color for the location on the right and title (left) makes a unreadable mess on smaller displays:
@@ -96,29 +84,78 @@ class SearchbarComponent(engine: SearchbarEngine, inkuireEngine: InkuireJSSearch | |||
}) | |||
wrapper | |||
|
|||
def createKindSeparator(kind: String) = | |||
val kindSeparator = document.createElement("div").asInstanceOf[html.Div] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pipe / tap from scala.util.chaining
?
val icon = document.createElement("span").asInstanceOf[html.Span] | ||
icon.classList.add("micon") | ||
icon.classList.add(kind.take(2)) | ||
val name = document.createElement("span").asInstanceOf[html.Span] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need those instanceOf-s? It it quite awkward
if the type is really needed then maybe it is a time for a small utility that would take the type of the element and create one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can spare them since you operate on html.Element
API
@@ -237,32 +273,50 @@ class SearchbarComponent(engine: SearchbarEngine, inkuireEngine: InkuireJSSearch | |||
val selectedElement = resultsDiv.querySelector("[selected]") | |||
if selectedElement != null then { | |||
selectedElement.removeAttribute("selected") | |||
val sibling = selectedElement.previousElementSibling | |||
if sibling != null && sibling.classList.contains("scaladoc-searchbar-result") then { | |||
def recur(elem: raw.Element): raw.Element = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please name it accordingly + most of the code is duplicated lower. You can just pass a function as an argument and extract those
icon.classList.add("fa-5x") | ||
val header = document.createElement("h1").asInstanceOf[html.Heading] | ||
header.textContent = "A bunch of hints to make your life easier" | ||
val listElements: ListRoot = ul( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should be ol
li("Type a phrase to search members <b>by name</b> and static sites <b>by title</b>"), | ||
li("Type abbreviations <b>cC, caCa, camCa</b> to search for <b>camelCase</b>"), | ||
li( | ||
"Type a function signature to search for members <b>by signature</b> using Inkuire", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you need a small version of some html library.
For now maybe expand utils you have above with b
and a
tags and change this "text"
61ed347
to
e8b03dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, though @MarcinAman nitpicks seem valid
e8b03dc
to
76d632b
Compare
No description provided.