From 5119018feeaa22c47c0e91e15d3b9414dd6e0772 Mon Sep 17 00:00:00 2001 From: grm Date: Wed, 16 Sep 2026 00:20:06 +0300 Subject: Put the header search box in the menu row, and stop saying "Search" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The header search was a band of its own under the menu; now it floats at the right end of the menu row and only gets a thin bar when the header has no menu. The forms are a single input — Enter and the phone keyboard's search key submit a one-field form everywhere — with the placeholder as the label, side boxes start without a heading, and the results page shows a box only when no module does, so a page no longer reads "Search" a dozen times. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- internal/web/layout.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/web/layout.go') diff --git a/internal/web/layout.go b/internal/web/layout.go index 0d51068..6f5c84f 100644 --- a/internal/web/layout.go +++ b/internal/web/layout.go @@ -124,6 +124,9 @@ type Layout struct { // A column is laid out when it has something to show — or always, when // the theme keeps the columns' space. HasLeft, HasRight bool + // A header search box sits in the menu row when there is one, so the two + // header modules need to know about each other. + HeaderMenu, HeaderSearch bool } // buildLayout groups modules by area, dropping areas the theme has switched off. @@ -136,6 +139,8 @@ func buildLayout(t Theme, mods []store.Module) Layout { switch m.Area { case "header": l.Header = append(l.Header, m) + l.HeaderMenu = l.HeaderMenu || m.Kind == "menu" + l.HeaderSearch = l.HeaderSearch || m.Kind == "search" case "left": l.Left = append(l.Left, m) case "right": @@ -181,6 +186,17 @@ func (l Layout) NeedsTags() bool { return false } +// HasSearch says whether a visible module offers a search box (the search +// page shows its own only when none does). +func (l Layout) HasSearch() bool { + for _, m := range l.all() { + if m.Kind == "search" { + return true + } + } + return false +} + // MaxRecent is the longest "recent posts" list any visible module wants (0 = none). func (l Layout) MaxRecent() int { n := 0 -- cgit v1.2.3