44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
class NavBar extends Shadow {
|
|
render() {
|
|
HStack(() => {
|
|
p("WHY?")
|
|
p("EVENTS")
|
|
p("JOIN")
|
|
p("SIGN IN")
|
|
})
|
|
.x(50, vw).y(4, em)
|
|
.center()
|
|
.fontSize(0.85, em)
|
|
.justifyContent("center")
|
|
.gap(3, em)
|
|
.paddingRight(2, em)
|
|
.onNavigate(() => {
|
|
console.log("hi")
|
|
})
|
|
.onAppear(() => {
|
|
Array.from(this.$("p")).forEach((el) => {
|
|
el.addEventListener("mousedown", (e) => {
|
|
el.classList.add("touched")
|
|
})
|
|
})
|
|
window.addEventListener("mouseup", (e) => {
|
|
let target = e.target
|
|
if(!target.matches("app-menu p")) {
|
|
return
|
|
}
|
|
|
|
target.classList.remove("touched")
|
|
|
|
if(target.classList.contains("selected")) {
|
|
this.selected = ""
|
|
window.navigateTo("/")
|
|
} else {
|
|
this.selected = target.innerText
|
|
window.navigateTo("/app/" + target.innerText.toLowerCase())
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
register(NavBar) |