Skip to content

Commit 49d75b1

Browse files
author
Filip Łukasik
committed
add arrow to dropdown button
1 parent 65a472b commit 49d75b1

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

scaladoc-js/main/src/versions-dropdown/DropdownHandler.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class DropdownHandler:
2929
ddc.appendChild(child)
3030

3131
private def disableButton() =
32-
val btn = document.getElementById("version-dropdown").asInstanceOf[html.Button]
33-
btn.disabled = true
34-
btn.classList.remove("dropdownbtnactive")
32+
val btn = document.getElementById("dropdown-trigger").asInstanceOf[html.Span]
33+
btn.classList.add("disabled")
3534

3635
private def getURLContent(url: String): Future[String] = Ajax.get(url).map(_.responseText)
3736

@@ -66,6 +65,7 @@ end DropdownHandler
6665
@JSExportTopLevel("dropdownHandler")
6766
def dropdownHandler(e: Event) =
6867
e.stopPropagation()
68+
console.log("clikc")
6969
if document.getElementById("version-dropdown").getElementsByTagName("a").size > 0 &&
7070
window.getSelection.toString.length == 0 then
7171
document.getElementById("version-dropdown").classList.toggle("expanded")
@@ -84,4 +84,4 @@ def filterFunction() =
8484
cl.remove("filtered")
8585
else
8686
cl.add("filtered")
87-
}
87+
}

scaladoc/resources/dotty_res/styles/theme/components/button/text-button.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
box-shadow: 0px 0px 0px 2px var(--focus-default);
2525
}
2626

27-
.text-button:disabled {
27+
.text-button.disabled {
2828
opacity: 0.5;
29+
pointer-events: none;
2930
}
3031

3132
.text-button::after {
@@ -34,9 +35,16 @@
3435

3536
/* button with arrow */
3637
.text-button.with-arrow::after {
37-
content: url("../../../../images/icon-buttons/hamburger/dark/default.svg");
3838
display: flex;
3939
flex-direction: row;
4040
align-items: center;
4141
justify-content: center;
4242
}
43+
44+
.text-button.with-arrow::after {
45+
content: url("../../../../images/icon-buttons/arrow-down/light/default.svg");
46+
}
47+
48+
.theme-dark .text-button.with-arrow::after {
49+
content: url("../../../../images/icon-buttons/arrow-down/dark/default.svg");
50+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
213213
div(cls := "header-container-left")(
214214
projectLogoElem.toSeq,
215215
darkProjectLogoElem.toSeq,
216-
span(onclick := "dropdownHandler(event)", cls := "text-button with-arrow")(
216+
span(onclick := "dropdownHandler(event)", cls := "text-button with-arrow", id := "dropdown-trigger")(
217217
a()(
218218
args.projectVersion.map(v => div(cls:="projectVersion")(v)).getOrElse("")
219219
),

0 commit comments

Comments
 (0)