gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit014d2b7f014d2b7fOne immutable readers snapshot per move for the left-organization event (#53)mre014d2b7f/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

  • 014d2b7fOne immutable readers snapshot per move for the left-organization event (#53)mre
  • 1859d506Decide who hears a repo left its organization by its readers before the move (#53)mre
  • 499f25f2Review fixes for the Settings organization move (#53)mre
  • ed3b922b|||PR move a repository into an organization in Settings (#53)mre
  • 74ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria
  • 9f7ce8d8Preserve rename compatibility and live page titlesmre
  • c3d95b6e|||PR separate names and addresses, rename repositories in Settings (#53)mre
  • ce08920dMerge branch 'w52c-header-phone' into mainGitoria
  • 0bab9e46|||PR header: ident status wraps on phones instead of clippingmre
  • e7af3eceMerge branch 'w52b-approval-followup' into mainGitoria
  • c01e66c6|||PR approvals follow-up: live Merge after status writes, helpers (#52)mre
  • 841da497Merge branch 'w53-pulls-speed-pr' into mainGitoria
  • 80307ae2|||PR pulls page cache: live PR numbers, complete scans onlymre
  • 69141f65|||PR pulls page: cache the git part per repo by branch tipsmre
  • 155861f6Merge branch 'w52-person-approval' into mainGitoria
  • b5435de8|||PR person approvals: second Kunibert round (#52)mre
  • 3a8b2fb8|||PR person approvals: Kunibert review fixes (#52)mre
  • 2a89d8d0|||PR person approvals: Approve button for people; merge needs the required checks or a listed person's approval (#52)mre
  • 83f0c953Report person approval verificationmre
  • 3ae94b86Record browser failures and verify owned tab cleanupmre