jukebox
All repositories: gitoria
3.2 KB
// main-menu.hl — THE MAIN MENU: the app's top-level links, `Series | Shows | Movies` (docs/layouts/main-menu.md).// Write it twice from ONE list: in the header (shown from 60rem) and in the sidebar (shown on the phone, where the// header has no room). The link whose href is `current` (or a page below it) is marked: class `current` and// aria-current="page". With no `current` given, the menu takes the page from the route (hybriel#197: `route = null`,// {path, params, pattern}, there in the server's HTML, so the marker is in the first paint and moves on a client click).// Without a matching path the host says which one: `current = "/docs"` (the page /read/x is// under Docs) or `current = true` on the item itself. An item may carry a small count: `count = 3` (a badge, not text).//// static menu = [ { label = 'Series' href = '/series' } { label = 'Movies' href = '/movies' } ]// AppHeader { MainMenu { items = menu current = "/series" } }// Sidebar { desktop = "false" MainMenu { items = menu current = "/series" } }Hybrid items = []String current = ''String label = 'Main menu'route = nullHybrid rows = build(items, current, route)// one row per link: the current one (the page itself or a page below it) is markedbuild(list, say, r) {// the host's say (`current`) wins; without one the shell's route (hybriel#197, in the server's HTML too) is the pageat = say != '' ? say : (r == null ? '' : r.path)out = []for (it of list) {let here = it.current == true || at == it.href || (it.href != '/' && at.startsWith(it.href + '/'))let n = it.count == null ? '' : '' + it.countout.push({ label = it.label href = it.href count = n has = n != '' cls = here ? 'current' : '' aria = here ? 'page' : 'false' })}return out}Style {mainMenu {display = 'block'a {display = 'flex'alignItems = 'center'minHeight = 'var(--layout-tap)'padding = '.55rem .75rem'fontWeight = '600'color = 'var(--color-text)'borderRadius = 'var(--radius-small)'hover {textDecoration = 'none'color = 'var(--color-text-strong)'background = 'var(--color-surface)'}'span.count' {marginLeft = '.5rem'padding = '0 .45rem'minWidth = '1.4rem'textAlign = 'center'fontSize = '.8rem'fontWeight = '700'lineHeight = '1.4rem'color = 'var(--color-accent-text)'background = 'var(--color-accent)'borderRadius = 'var(--radius-small)'}}'a.current' {color = 'var(--color-accent)'background = 'var(--color-surface)'}}'application-header' {mainMenu {display = 'none'@media {minWidth = '60rem'display = 'block'marginLeft = 'auto'}nav {@media {minWidth = '60rem'display = 'flex'gap = '.15rem'}}}}'app-sidebar' {mainMenu {marginBottom = '1rem'@media {minWidth = '60rem'display = 'none'}}}@media {minWidth = '60rem''application-header' {mainMenu {a {minHeight = '2.25rem'padding = '.45rem .7rem'}}}}}View {mainMenu {nav { 'aria-label' = labelfor (r of rows) { a { href = r.href class = r.cls 'aria-current' = r.aria r.label if (r.has) { span { class = 'count' r.count } } } }}}}
Branches
Latest commits
- 5838d6c7|||PR STATUS: #22 pending decision, PR-only rulemre
- 29d2029cRecords: PR-only rule (Kunibert)mre
- adacb0abRecords: neutral ticket rule, #22 decision recordedmre
- b2d6f121Records: #308 hold liftedmre
- 7ab67533Records: day39 on hold (hybriel#308)mre
- 22f21739Records: note rebase before mergemre
- f7368ea3Records: mission 011 day39, waits for lisbethmre
- 9515d2cdRecords: jb20 livemre
- 019f6601ui gate: comment names the open bug components#27 (workaround, not fixed)mre
- 277a2722README: provenance linemre
- 4169ca6aREADME: sync pinmre
- a01f3aa8ui gate: back to the top before the sort checks (the screen reopens where it was left)mre
- f7936c20Lists keep their scroll position across a reload (jukebox#20): per-list offsets in storage/ui.json, gate jb20mre
- d67906devirtual-list and icons from components.hybriel e5b98ec (centerId, scrollTop, onScroll)mre
- df7920ceRecords: R3 startedmre
- 0549f038Mission 010: jb20 livemre
- 273494e2STATUS rewrittenmre
- 227c9b96Records: jb19 livemre
- 9f365376README: the bar's controls (jb19)mre
- d18851fdjb19: pressed switches look different (whole selector), queue column cannot widen past the panel, gates follow the new bar (jb3, jb11, jb15)mre