gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit3a68cfac3a68cfaclog: components decisionmre3a68cfac/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

  • 3a68cfaclog: components decisionmre
  • 87de8e31log: Kunibert connected to 9 app reposmre
  • c22aff69log: PR-only rollout startedmre
  • 25309981log: STOP and paused workers 2026-11-08mre
  • 5286803alog: worker briefs and reports of 2026-11-08mre
  • 85c86605log: 2026-11-08 Arachne on list shapemre
  • cb634512log: 2026-11-08 keyed lists livemre
  • 07c98d4aLists: keyed rows with @id, remove(id) and one whole-list assignment instead of hand-rebuilt loopsmre
  • 0db0d81elog: 2026-11-08 day52 live, W30 startedmre
  • b05f6d92tests/status: the gate's 3 s app token expired during the restart; it lives 60 s like status-keyedmre
  • 1e8f4f0avendor: Hybriel set-day52 (fault-path leak fix #335, keyed rows #331)mre
  • f5f0fb7blog: 2026-11-08 day50/#29 live, H25 correction, V52 startedmre
  • dc77fb95main: offline note from __hlOnline, tick removed (#29)mre
  • 37a86d93tests/reviews: seeded fake hook's DNS failures are not server errors (flaky gate)mre
  • 07ab845bvendor: Hybriel set-day50 (run() leak fix #335)mre
  • 71b2fa4blog: hybriel#335mre
  • bd94cc7elog: #25 cause found (run() leak)mre
  • 565cb508log: H25 round 1mre
  • 90a0af84log: H25 startedmre
  • 87bd53b8mission H25mre