gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmain10f8a8c8Merge branch 'code-order' into mainJukeboxmain/theme/shell/main-menu.hl

3.2 KB

  1. // main-menu.hl — THE MAIN MENU: the app's top-level links, `Series | Shows | Movies` (docs/layouts/main-menu.md).
  2. // Write it twice from ONE list: in the header (shown from 60rem) and in the sidebar (shown on the phone, where the
  3. // header has no room). The link whose href is `current` (or a page below it) is marked: class `current` and
  4. // aria-current="page". With no `current` given, the menu takes the page from the route (hybriel#197: `route = null`,
  5. // {path, params, pattern}, there in the server's HTML, so the marker is in the first paint and moves on a client click).
  6. // Without a matching path the host says which one: `current = "/docs"` (the page /read/x is
  7. // under Docs) or `current = true` on the item itself. An item may carry a small count: `count = 3` (a badge, not text).
  8. //
  9. // static menu = [ { label = 'Series' href = '/series' } { label = 'Movies' href = '/movies' } ]
  10. // AppHeader { MainMenu { items = menu current = "/series" } }
  11. // Sidebar { desktop = "false" MainMenu { items = menu current = "/series" } }
  12. Hybrid items = []
  13. String current = ''
  14. String label = 'Main menu'
  15. route = null
  16. Hybrid rows = build(items, current, route)
  17. // one row per link: the current one (the page itself or a page below it) is marked
  18. build(list, say, r) {
  19. // the host's say (`current`) wins; without one the shell's route (hybriel#197, in the server's HTML too) is the page
  20. at = say != '' ? say : (r == null ? '' : r.path)
  21. out = []
  22. for (it of list) {
  23. let here = it.current == true || at == it.href || (it.href != '/' && at.startsWith(it.href + '/'))
  24. let n = it.count == null ? '' : '' + it.count
  25. out.push({ label = it.label href = it.href count = n has = n != '' cls = here ? 'current' : '' aria = here ? 'page' : 'false' })
  26. }
  27. return out
  28. }
  29. Style {
  30. mainMenu {
  31. display = 'block'
  32. a {
  33. display = 'flex'
  34. alignItems = 'center'
  35. minHeight = 'var(--layout-tap)'
  36. padding = '.55rem .75rem'
  37. fontWeight = '600'
  38. color = 'var(--color-text)'
  39. borderRadius = 'var(--radius-small)'
  40. hover {
  41. textDecoration = 'none'
  42. color = 'var(--color-text-strong)'
  43. background = 'var(--color-surface)'
  44. }
  45. 'span.count' {
  46. marginLeft = '.5rem'
  47. padding = '0 .45rem'
  48. minWidth = '1.4rem'
  49. textAlign = 'center'
  50. fontSize = '.8rem'
  51. fontWeight = '700'
  52. lineHeight = '1.4rem'
  53. color = 'var(--color-accent-text)'
  54. background = 'var(--color-accent)'
  55. borderRadius = 'var(--radius-small)'
  56. }
  57. }
  58. 'a.current' {
  59. color = 'var(--color-accent)'
  60. background = 'var(--color-surface)'
  61. }
  62. }
  63. 'application-header' {
  64. mainMenu {
  65. display = 'none'
  66. @media {
  67. minWidth = '60rem'
  68. display = 'block'
  69. marginLeft = 'auto'
  70. }
  71. nav {
  72. @media {
  73. minWidth = '60rem'
  74. display = 'flex'
  75. gap = '.15rem'
  76. }
  77. }
  78. }
  79. }
  80. 'app-sidebar' {
  81. mainMenu {
  82. marginBottom = '1rem'
  83. @media {
  84. minWidth = '60rem'
  85. display = 'none'
  86. }
  87. }
  88. }
  89. @media {
  90. minWidth = '60rem'
  91. 'application-header' {
  92. mainMenu {
  93. a {
  94. minHeight = '2.25rem'
  95. padding = '.45rem .7rem'
  96. }
  97. }
  98. }
  99. }
  100. }
  101. View {
  102. mainMenu {
  103. nav { 'aria-label' = label
  104. for (r of rows) { a { href = r.href class = r.cls 'aria-current' = r.aria r.label if (r.has) { span { class = 'count' r.count } } } }
  105. }
  106. }
  107. }

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