transition from parchment to downloads
This commit is contained in:
37
ui/components/NavMenu.js
Normal file
37
ui/components/NavMenu.js
Normal file
@@ -0,0 +1,37 @@
|
||||
class NavMenu extends Shadow {
|
||||
|
||||
NavButton(text) {
|
||||
return p(text)
|
||||
.cursor("default")
|
||||
.onAppear(function () {
|
||||
console.log(window.location.pathname, "/" + this.innerText.toLowerCase())
|
||||
if(window.location.pathname === ("/" + this.innerText.toLowerCase())) {
|
||||
this.style.textDecoration = "underline"
|
||||
}
|
||||
})
|
||||
.onHover(function (hovering) {
|
||||
if(hovering) {
|
||||
this.style.textDecoration = "underline"
|
||||
} else {
|
||||
this.style.textDecoration = ""
|
||||
}
|
||||
})
|
||||
.onClick(function (done) {
|
||||
if(done) {
|
||||
window.navigateTo(this.innerText === "Home" ? "/" : this.innerText.toLowerCase())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
HStack(() => {
|
||||
this.NavButton("Home")
|
||||
this.NavButton("Downloads")
|
||||
})
|
||||
.gap(2, em)
|
||||
.x(50, vw).y(5, vh)
|
||||
.center()
|
||||
}
|
||||
}
|
||||
|
||||
register(NavMenu)
|
||||
Reference in New Issue
Block a user