Modern style as the new default; style axis, slate palette, nav groups and icons
A third appearance axis, PageHeader.Style (<html data-style>), with StyleModern -- the default when Style is empty -- and StyleClassic, the look up to v0.4.x. The modern style is one [data-style="modern"] block at the end of style.css over the classic rules: navbar without a rule, the sidebar as a floating rounded card with group headings, icons and a pill for the active entry, rounder and quieter Bootstrap components. In it inactive sidebar links use the text color; #0b82b8 now only colors them in the classic style (owner decision 2026-11-28). - appearance menu: "Style"/"Stil" section, cookie yw_style - palette slate (dark slate and lavender) - NavItem.Group (sidebar group headings) and NavItem.Icon (names from the new NavIcons set, shown only in the modern style) - cmd/webui-demo: a sample page for comparing styles, palettes and modes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7afb6a022a
commit
33dfebab9e
13 files changed
+771
-28
No files matched your search
@@ -41,6 +41,37 @@ type NavItem struct {
|
||||
ID string // matches PageHeader.ActiveNav to mark this item active
|
||||
Label string
|
||||
Href string // BasePath-relative, e.g. "/tasks"
|
||||
// Group, when set, puts a small heading above the first item of a
|
||||
// run of items with the same Group ("Account", "Downloads", ...).
|
||||
Group string
|
||||
// Icon names one of NavIcons ("dashboard", "settings", ...); unknown
|
||||
// names render nothing. Only StyleModern shows icons, so setting it
|
||||
// leaves the classic look unchanged.
|
||||
Icon string
|
||||
}
|
||||
|
||||
// SidebarEntry is one NavItem as the sidebar template renders it.
|
||||
type SidebarEntry struct {
|
||||
NavItem
|
||||
Active bool
|
||||
GroupHead string // the group heading to render before this item, if any
|
||||
IconSVG template.HTML // NavIcons[Icon]
|
||||
}
|
||||
|
||||
// SidebarEntries resolves NavItems for the sidebar template: active
|
||||
// state, group headings (once per run of equal Group values) and icons.
|
||||
func (h PageHeader) SidebarEntries() []SidebarEntry {
|
||||
out := make([]SidebarEntry, len(h.NavItems))
|
||||
prev := ""
|
||||
for i, n := range h.NavItems {
|
||||
e := SidebarEntry{NavItem: n, Active: n.ID == h.ActiveNav, IconSVG: navIcon(n.Icon)}
|
||||
if n.Group != "" && n.Group != prev {
|
||||
e.GroupHead = n.Group
|
||||
}
|
||||
prev = n.Group
|
||||
out[i] = e
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// PageHeader holds the fields every page's own data struct should embed
|
||||
@@ -69,6 +100,10 @@ type PageHeader struct {
|
||||
// PaletteDefault. ApplyAppearance fills Theme and Palette from the
|
||||
// visitor's cookies (see README.md's Theming section).
|
||||
Palette string
|
||||
// Style is the shape of the chrome, rendered as <html
|
||||
// data-style="...">: StyleModern (also "") or StyleClassic.
|
||||
// ApplyAppearance fills it from the visitor's cookie.
|
||||
Style string
|
||||
// AppearancePath is the BasePath-relative POST route of
|
||||
// AppearanceHandler, e.g. "/appearance"; set, the navbar shows the
|
||||
// theme/palette menu. AppearanceBack is the BasePath-relative page
|
||||
|
||||
Reference in new issue
Block a user