From d78a182f0d666986ca09b48f37cdbaac4b57cee7 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 24 May 2026 21:20:36 -0400 Subject: [PATCH] feat(header): add responsive mobile hamburger menu with slide-down panel On viewports below 970px the header now collapses to a compact bar with only the Bookhoard logo and a hamburger button. Clicking the hamburger reveals a slide-down panel containing: - Full-text search input (wired to the existing debounced search API) - Navigation links (Library, All Books, Series, Collections, Progress, Devices) - Collapsible theme switcher with all 7 themes and 4 bookshelf backgrounds - User section: profile/admin/logout when logged in, inline login form when logged out Changes: - templates/header.templ: add hamburger button, mobile panel with all controls, hide desktop search/theme/user controls below nav breakpoint - web/src/header.ts: add mobileMenuOpen state to Alpine header component - web/src/search.ts: refactor initializeSearch to wire both desktop and mobile search inputs, track active input for results container placement - tailwind.config.ts: add custom 'nav' screen breakpoint at 970px so the mobile menu activates before the search bar becomes unusable - web/static/style.css: rebuilt with new nav breakpoint utility classes --- tailwind.config.ts | 22 ++++ templates/header.templ | 234 +++++++++++++++++++++++++++++++++++++- templates/header_templ.go | 44 ++++++- web/src/header.ts | 1 + web/src/search.ts | 81 ++++++++----- web/static/style.css | 2 +- 6 files changed, 349 insertions(+), 35 deletions(-) diff --git a/tailwind.config.ts b/tailwind.config.ts index 01131c5..f00ad4f 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -21,6 +21,28 @@ const config: Config = { ], theme: { extend: { + screens: { + nav: "970px", + }, + fontFamily: { + sans: [ + "ui-sans-serif", + "system-ui", + "sans-serif", + '"Noto Sans SC"', + '"Noto Sans TC"', + '"Noto Sans JP"', + '"Noto Sans KR"', + '"PingFang SC"', + '"Microsoft YaHei"', + '"Hiragino Sans"', + '"Apple SD Gothic Neo"', + "Apple Color Emoji", + "Segoe UI Emoji", + "Segoe UI Symbol", + "Noto Color Emoji", + ], + }, colors: { primary: { DEFAULT: "#7aa2f7", diff --git a/templates/header.templ b/templates/header.templ index af38bf7..a52d6bc 100644 --- a/templates/header.templ +++ b/templates/header.templ @@ -23,7 +23,7 @@ templ Header(user User, currentPath string) { - -
+