gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitaa2d124eaa2d124eREADME: the #94 purge gatemreaa2d124e/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

  • aa2d124eREADME: the #94 purge gatemre
  • e843ff7cOne-time purge of miserit-anthar#94 (#94, identity rule): idempotent step in lib/migrate.hl, fixture gate tests/purge94.mjsmre
  • 506a4efdmission 028: #94, identity rulemre
  • 78c7f48eRefine mpackdb holdmre
  • 3d7d89c8Record mpackdb hold until day38mre
  • f1bf7195#51 done; my subscription idmre
  • 9870b945status: #51 proof greenmre
  • e92173c6log: #51 live push proofmre
  • 72d87041log: Hermes push livemre
  • 1d69bf7dTickets conductor: park until Hermes pushmre
  • 80d8cfd1Tickets conductor: #51 livemre
  • 61641dd9Complete subscriptions deployment evidencemre
  • c980856cRecord successful subscriptions deployment and live checksmre
  • 4b4710adMerge branch 's51-subscriptions'mre
  • a731ef7eTickets conductor: S51 reviewed, deploy stepmre
  • b487b05aRecord verified direct push protocol handoffmre
  • 74e34cc3Verify encrypted push secrets and direct push retry semanticsmre
  • a1ac5cd0Push subscription notices directly to signed HyperConductor chat endpointsmre
  • d662ad27Remove superseded waker service for direct chat push protocolmre
  • c0ac927aTickets conductor: S51 redo for push protocolmre