pages: home, login, signup, signin, add are almost done

This commit is contained in:
2023-11-16 00:46:49 +01:00
parent e8fe008117
commit ea34fa8eb4
8 changed files with 88 additions and 44 deletions

5
frontend/js/home.js Normal file
View File

@ -0,0 +1,5 @@
qSA(".card-beer").forEach(el => {
el.addEventListener("click", (e) => {
window.location.href = "/beer/" + el.querySelector("img").id
})
});

View File

@ -3,14 +3,12 @@ function show_modal(selector, modal_selector = null) {
if(modal_selector === null) {
modal_selector = selector
}
const btn = qS(selector)
const md = qS(modal_selector)
btn.addEventListener("click", (el) => {
md.classList.add("md-active")
})
} catch (error) {
console.error(error)
}
}
@ -19,6 +17,9 @@ show_modal("#nav-login", "#md-login")
show_modal("#nav-signup", "#md-signup")
show_modal(".nav-user", "#md-user-tree")
qS(".nav-user").addEventListener("click", () => {
qS(".nav-user-dropdown").classList.toggle("visible")
})
try {
qS(".nav-user").addEventListener("click", () => {
qS(".nav-user-dropdown").classList.toggle("visible")
})
} catch (err) {
}