gitoria

jukebox

All repositories: gitoria

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

3.2 KB

  1. // user-menu.hl — THE USER MENU: one icon at the header's right end; a tap opens a dropdown with the signed-in name and the
  2. // links the app puts in (last always Logout, before it Settings — creator, tracker#32) (docs/layouts/user-menu.md).
  3. // Signed out, the app puts its login (the ident selector) in the header INSTEAD of this component.
  4. //
  5. // AppHeader { … UserMenu { name = "az5b2" a { href = "/settings" "Settings" } a { href = "/logout" "Logout" } } }
  6. //
  7. // The dropdown is the browser's popover `#user-menu`: Esc and a tap outside close it, and so does a tap on one of its links.
  8. String name = ''
  9. String label = 'User menu'
  10. slot = null
  11. Style {
  12. userMenu {
  13. display = 'block'
  14. flex = 'none'
  15. '> button' {
  16. width = 'var(--layout-tap)'
  17. height = 'var(--layout-tap)'
  18. minHeight = '0'
  19. marginRight = '-.625rem'
  20. padding = '0'
  21. color = 'var(--color-text)'
  22. svg {
  23. width = '1.5rem'
  24. height = '1.5rem'
  25. }
  26. }
  27. '> nav:popover-open' {
  28. position = 'fixed'
  29. inset = 'var(--layout-header) max(var(--layout-gutter), calc((100% - var(--layout-column)) / 2)) auto auto'
  30. display = 'block'
  31. minWidth = '12rem'
  32. maxWidth = 'calc(100vw - 2 * var(--layout-gutter))'
  33. margin = '.25rem 0 0'
  34. padding = '.4rem'
  35. color = 'var(--color-text)'
  36. background = 'var(--color-surface)'
  37. border = '0'
  38. borderRadius = 'var(--radius-large)'
  39. boxShadow = '0 .75rem 2rem var(--color-background-sunken)'
  40. }
  41. 'p.who' {
  42. margin = '0'
  43. padding = '.4rem .6rem .5rem'
  44. fontSize = '.85rem'
  45. color = 'var(--color-text-muted)'
  46. overflow = 'hidden'
  47. textOverflow = 'ellipsis'
  48. whiteSpace = 'nowrap'
  49. empty { display = 'none' }
  50. }
  51. }
  52. // Keep the whole selector for selector list, :has condition.
  53. 'body:has(list-first) user-menu > nav:popover-open,
  54. body:has(three-pane) user-menu > nav:popover-open' { right = 'var(--layout-gutter)' }
  55. // Keep the whole selector for pseudo-element.
  56. 'user-menu > nav::backdrop' { background = 'transparent' }
  57. // Keep the whole selector for selector list.
  58. 'user-menu > nav a,
  59. user-menu > nav button' {
  60. display = 'flex'
  61. width = '100%'
  62. minHeight = 'var(--layout-tap)'
  63. alignItems = 'center'
  64. justifyContent = 'flex-start'
  65. padding = '.5rem .6rem'
  66. fontWeight = '600'
  67. color = 'var(--color-text)'
  68. borderRadius = 'var(--radius-small)'
  69. }
  70. // Keep the whole selector for selector list.
  71. 'user-menu > nav a:hover,
  72. user-menu > nav button:hover' {
  73. textDecoration = 'none'
  74. color = 'var(--color-text-strong)'
  75. background = 'var(--color-background)'
  76. }
  77. }
  78. View {
  79. userMenu {
  80. button { type = "button" class = "user-toggle" popovertarget = "user-menu" title = label 'aria-label' = label
  81. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "1.8" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  82. circle { cx = "12" cy = "12" r = "10" }
  83. circle { cx = "12" cy = "10" r = "3.2" }
  84. path { d = "M6.2 18.6c1.4-2.2 3.4-3.3 5.8-3.3s4.4 1.1 5.8 3.3" }
  85. }
  86. }
  87. nav { id = "user-menu" popover = "auto" 'aria-label' = label on click(e) { emit userMenuClick(e) }
  88. p { class = "who" name }
  89. slot
  90. }
  91. }
  92. }
  93. // a tap on one of its links closes the dropdown (a page change in place would leave it open)
  94. on userMenuClick(e) {
  95. if (e.target.closest('a') != null) { e.currentTarget.hidePopover() }
  96. }

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