gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitf13a655ef13a655elayouts#9: editor toolbar and comment-history density back at their 60rem cutoffsAtlasf13a655e/theme/shell/main-menu.hl

3.4 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 768px) 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(Hybrid list, String say, Hybrid 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. here = it.current == true || at == it.href || (it.href != '/' && at.startsWith(it.href + '/'))
  24. 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. whiteSpace = 'nowrap'
  39. color = 'var(--color-text)'
  40. borderRadius = 'var(--radius-small)'
  41. hover {
  42. textDecoration = 'none'
  43. color = 'var(--color-text-strong)'
  44. background = 'var(--color-surface)'
  45. }
  46. 'span.count' {
  47. marginLeft = '.5rem'
  48. padding = '0 .45rem'
  49. minWidth = '1.4rem'
  50. textAlign = 'center'
  51. fontSize = '.8rem'
  52. fontWeight = '700'
  53. lineHeight = '1.4rem'
  54. color = 'var(--color-accent-text)'
  55. background = 'var(--color-accent)'
  56. borderRadius = 'var(--radius-small)'
  57. }
  58. }
  59. 'a.current' {
  60. color = 'var(--color-accent)'
  61. background = 'var(--color-surface)'
  62. }
  63. }
  64. 'application-header' {
  65. mainMenu {
  66. display = 'none'
  67. @media {
  68. minWidth = '768px'
  69. display = 'block'
  70. marginLeft = 'auto'
  71. }
  72. nav {
  73. @media {
  74. minWidth = '768px'
  75. display = 'flex'
  76. gap = '.15rem'
  77. }
  78. }
  79. }
  80. }
  81. 'app-sidebar' {
  82. mainMenu {
  83. marginBottom = '1rem'
  84. a {
  85. padding = '.25rem .5rem'
  86. hover { background = 'transparent' }
  87. }
  88. 'a.current' {
  89. color = 'var(--color-active-text)'
  90. background = 'var(--color-active-bg)'
  91. }
  92. @media {
  93. minWidth = '768px'
  94. display = 'none'
  95. }
  96. }
  97. }
  98. @media {
  99. // density (tap size) stays at 60rem
  100. minWidth = '60rem'
  101. 'application-header' {
  102. mainMenu {
  103. a {
  104. minHeight = '2.25rem'
  105. padding = '.45rem .7rem'
  106. }
  107. }
  108. }
  109. }
  110. }
  111. View {
  112. mainMenu {
  113. nav { 'aria-label' = label
  114. 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 } } } }
  115. }
  116. }
  117. }

Branches

Latest commits

  • f13a655elayouts#9: editor toolbar and comment-history density back at their 60rem cutoffsAtlas
  • b243fffalayouts#9: tap density stays at 60rem; palette rule names HyperConductorAtlas
  • 2027f696layouts#9: field focus glow back to HyperConductor's .45Atlas
  • 88e1d14d|||PR layouts#9: address Kunibert findings (3-pane 768px, :where invalid focus, placeholder & glow contrast)Atlas
  • 8c875a78|||PR layouts#9: match HyperConductor look (lines 1-21)Atlas
  • 4099e64aMerge branch 'font-segoe-ui' into mainAtlas
  • e14fb795|||PR Theme font: Segoe UI first (his choice 2026-11-19)Atlas
  • 44071d2cMerge branch 'hl-standard-5' into mainAtlas
  • 5ea64202|||PR Gate: count the new-tab check's console errors tooAtlas
  • 2752ceddMerge branch 'hl-standard-4' into mainAtlas
  • ac552b81|||PR Gate: keyboard (Tab/Enter/Space) and Back/Forward/reload/new-tab checks (HL-STANDARD F5, F21)Atlas
  • 8cddcaa9Merge branch 'hl-standard-2' into mainAtlas
  • 2b480a64|||PR Type the route parameter of main-menu build (HL-STANDARD L10)Atlas
  • ab54a39dMerge branch 'hl-standard' into mainAtlas
  • 04d36fcf|||PR Type function parameters and drop unneeded let (HL-STANDARD L2, L10)Atlas
  • 220c8fa4Merge branch 'readme-audit' into mainAtlas
  • b78fb85a|||PR README matches the codemre
  • 9f351699Preserve comments and nest supported selectors without changing rendered outputmre
  • 97110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre
  • ce4a0baeKeep caller slot styles whole so minimal shell apps startmre