aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/layout.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/layout.go')
-rw-r--r--internal/web/layout.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/web/layout.go b/internal/web/layout.go
index 91728ed..d201758 100644
--- a/internal/web/layout.go
+++ b/internal/web/layout.go
@@ -130,6 +130,12 @@ type Layout struct {
// 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
+ // Fold says the header menu folds into a button (theme nav_fold, and a
+ // menu in the header); BurgerAt is the index in Header of the module that
+ // carries the button: the title or logo block just before the menu, so it
+ // sits at the right of the brand, else the menu bar itself.
+ Fold bool
+ BurgerAt int
}
// buildLayout groups modules by area, dropping areas the theme has switched off.
@@ -156,6 +162,18 @@ func buildLayout(t Theme, mods []store.Module) Layout {
l.Footer = append(l.Footer, m)
}
}
+ if t.NavFold {
+ for j, m := range l.Header {
+ if m.Kind != "menu" {
+ continue
+ }
+ l.Fold, l.BurgerAt = true, j
+ if j > 0 && (l.Header[j-1].Kind == "title" || l.Header[j-1].Kind == "logo" && t.Logo != "") { // a logo module without a logo renders nothing
+ l.BurgerAt = j - 1
+ }
+ break
+ }
+ }
l.HasLeft = t.KeepColumns || len(l.Left) > 0
l.HasRight = t.KeepColumns || len(l.Right) > 0
return l