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
- 10f8a8c8Merge branch 'code-order' into mainJukebox
- 204fc828Merge branch 'day72' into mainJukebox
- 95f5faae|||PR jukebox#7 Drop needless let declarationsmre
- 33072bb5|||PR Record day72 gates and Chrome proofmre
- 95f2cd73|||PR Use typed parent methods for screen playback and local server facesmre
- 6422a020Sync media-player at 51c3818mre
- b582ba1cVendor complete Hybriel day72 plugin setmre
- 02dccbc9Merge branch 'records-1119' into mainJukebox
- a39e1c23|||PR Records: missions 013-015, reconnect fix livemre
- fc7db075Merge branch 'reconnect-retry' into mainJukebox
- ac6f4c6fL2: plain declaration for a in pickedNextmre
- 2f335086Review round 2: only an explicit queue pick drops pend (not the automatic advance); jb23 records every source changemre
- 3eb6695fReview fixes: action generation, queue pick clears pend, Previous/Next retry the decided request, typed handlersmre
- 7a53c0c2|||PR A tap lost to a dead socket plays after reconnect (mission 015)mre
- 1f0cd77bMerge branch 'records-day41' into mainJukebox
- 67be229f|||PR Records: day41 live (PR #4), mission 012, statusmre
- 0bb027daconductor: caramboleyo is the user, not owner/creatorApollo
- 04f5d9d5Merge branch 'day41' into mainJukebox
- 8ed6da45|||PR README: media-player pin df9e7dfmre
- d5d45fc3|||PR media-player df9e7df (repeat-one fix), sync pin and SOURCEmre