gitoria

jukebox

All repositories: gitoria

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

5.2 KB

  1. // app-header.hl — THE HEADER of a WorldAPI app: brand, search, main menu, user menu (docs/layouts/app-header.md).
  2. // Phone: [sidebar toggle] brand … [loupe] [user menu]; the main menu lives in the sidebar overlay, the search field opens
  3. // under the bar from the loupe. Desktop (60rem+): brand · search in the middle · main menu · user menu; the toggle and the
  4. // loupe are gone. The bar's background runs full width, its contents start and end flush with the content column
  5. // (--layout-column); in the full-width shells (list-first, three-pane) they span the page.
  6. //
  7. // AppHeader { brand = "Tracker" search = "/search"
  8. // MainMenu { items = menu current = "/series" }
  9. // UserMenu { name = "az5b2" a { href = "/settings" "Settings" } a { href = "/logout" "Logout" } }
  10. // }
  11. //
  12. // The toggle opens `#sidebar` (theme/shell/app-sidebar.hl) with the browser's popover: no script, Esc and a tap outside
  13. // close it. A page without a sidebar shows no toggle. The search field is the popover `#app-search` on the phone.
  14. String brand = 'WorldAPI'
  15. String brandHref = '/'
  16. String search = '' // the search form's action ('' = no search); it sends GET <search>?<searchName>=…
  17. String searchName = 'q'
  18. String searchLabel = 'Search'
  19. String searchPlaceholder = 'Search…'
  20. String menuLabel = 'Menu'
  21. Boolean hasSearch = search != ''
  22. slot = null
  23. Style {
  24. applicationHeader {
  25. position = 'sticky'
  26. top = '0'
  27. zIndex = '20'
  28. display = 'flex'
  29. alignItems = 'center'
  30. gap = '.25rem'
  31. height = 'var(--layout-header)'
  32. paddingInline = 'max(var(--layout-gutter), calc((100% - var(--layout-column)) / 2))'
  33. background = 'var(--color-background-sunken)'
  34. '> a.brand' {
  35. flex = '0 1 auto'
  36. minWidth = '0'
  37. marginRight = 'auto'
  38. overflow = 'hidden'
  39. lineHeight = 'var(--layout-tap)'
  40. fontSize = '1.1rem'
  41. fontWeight = '800'
  42. color = 'var(--color-text-strong)'
  43. textOverflow = 'ellipsis'
  44. whiteSpace = 'nowrap'
  45. hover {
  46. textDecoration = 'none'
  47. color = 'var(--color-accent)'
  48. }
  49. }
  50. '> button' {
  51. flex = 'none'
  52. width = 'var(--layout-tap)'
  53. height = 'var(--layout-tap)'
  54. minHeight = '0'
  55. padding = '0'
  56. color = 'var(--color-text)'
  57. }
  58. '> button.menu-toggle' { marginLeft = '-.625rem' }
  59. '> form.search:popover-open' {
  60. position = 'fixed'
  61. inset = 'var(--layout-header) 0 auto 0'
  62. display = 'block'
  63. width = '100%'
  64. height = 'auto'
  65. margin = '0'
  66. padding = '.5rem var(--layout-gutter) .75rem'
  67. color = 'var(--color-text)'
  68. background = 'var(--color-background-sunken)'
  69. border = '0'
  70. }
  71. '> form.search:not(:popover-open)' { display = 'none' }
  72. '> form.search' {
  73. input {
  74. width = '100%'
  75. minHeight = 'var(--layout-tap)'
  76. background = 'var(--color-background)'
  77. }
  78. }
  79. @media {
  80. minWidth = '60rem'
  81. gap = '1rem'
  82. '> form.search' {
  83. input {
  84. minHeight = '2.25rem'
  85. padding = '.4rem .8rem'
  86. }
  87. }
  88. }
  89. }
  90. // Keep the whole selector for :has condition.
  91. 'body:not(:has(#sidebar)) application-header > button.menu-toggle' { display = 'none' }
  92. // Keep the whole selector for pseudo-element.
  93. 'application-header > form.search::backdrop' { background = 'transparent' }
  94. // Keep the whole selector for selector list, :has condition.
  95. 'body:has(list-first) application-header,
  96. body:has(three-pane) application-header' { paddingInline = 'var(--layout-gutter)' }
  97. // Keep the whole selector for selector list.
  98. 'application-header > button.menu-toggle,
  99. application-header > button.search-toggle' {
  100. @media {
  101. minWidth = '60rem'
  102. display = 'none'
  103. }
  104. }
  105. @media {
  106. minWidth = '60rem'
  107. // Keep the whole selector for selector list.
  108. 'application-header > form.search,
  109. application-header > form.search:not(:popover-open),
  110. application-header > form.search:popover-open' {
  111. position = 'static'
  112. inset = 'auto'
  113. display = 'flex'
  114. flex = '1 1 auto'
  115. width = 'auto'
  116. maxWidth = '28rem'
  117. height = 'auto'
  118. margin = '0 auto'
  119. padding = '0'
  120. overflow = 'visible'
  121. color = 'inherit'
  122. background = 'transparent'
  123. border = '0'
  124. }
  125. }
  126. }
  127. View {
  128. applicationHeader {
  129. button { type = "button" class = "menu-toggle" popovertarget = "sidebar" title = menuLabel 'aria-label' = menuLabel
  130. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "2" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  131. path { d = "M4 6h16M4 12h16M4 18h16" }
  132. }
  133. }
  134. a { class = "brand" href = brandHref brand }
  135. if (hasSearch) {
  136. form { id = "app-search" class = "search" role = "search" method = "get" action = search popover = "auto" on toggle(e) { emit headerSearchToggle(e) }
  137. input { type = "search" name = searchName placeholder = searchPlaceholder 'aria-label' = searchLabel autocomplete = "off" }
  138. }
  139. button { type = "button" class = "search-toggle" popovertarget = "app-search" title = searchLabel 'aria-label' = searchLabel
  140. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "2" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  141. circle { cx = "11" cy = "11" r = "6.5" }
  142. path { d = "M16 16l4.5 4.5" }
  143. }
  144. }
  145. }
  146. slot
  147. }
  148. }
  149. // the phone's search opened: the field takes the focus (the popover has none of its own)
  150. on headerSearchToggle(e) {
  151. if (e.newState == 'open') { e.target.querySelector('input').focus() }
  152. }

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