Tidy up homepage and navigation

This commit is contained in:
Dan Milne
2025-11-09 20:58:13 +11:00
parent c9e2992fe0
commit 1f4428348d
56 changed files with 2822 additions and 955 deletions

View File

@@ -0,0 +1,29 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["menu"]
connect() {
// Add click outside listener to close dropdown
this.boundHide = this.hide.bind(this)
document.addEventListener("click", this.boundHide)
}
disconnect() {
document.removeEventListener("click", this.boundHide)
}
toggle(event) {
event.preventDefault()
event.stopPropagation()
this.menuTarget.classList.toggle("hidden")
}
hide(event) {
// Don't hide if clicking inside the dropdown
if (this.element.contains(event.target)) return
this.menuTarget.classList.add("hidden")
}
}