gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7663965576639655Records: B1 questionmre76639655/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

  • 76639655Records: B1 questionmre
  • d7906b36Records: mission 005 startedmre
  • d3df773cMission 005: doc linemre
  • 6a5d840aMission 005: jukebox#22mre
  • 13e5e748Records: mission 004 startedmre
  • a8098271Mission 004: jukebox#21mre
  • df8f5205Records: jukebox#19-21, #11 closedmre
  • b7a4e692Records: hybriel#298mre
  • 9bcbb017Records: day38b waits for day39 fixmre
  • f80504e1Records: day38b repro sentmre
  • 8048258bRecords: day38b jb3 regression, L1 Chromes stoppedmre
  • 68aace7fRecords: mission 003 day38bmre
  • d105d8a9Records: mpackdb integrity check cleanmre
  • 6e980c53Records: mpackdb rule refinementmre
  • 6d335ac4Records: storage copy rulingmre
  • 7eb2898dRecords: mpackdb second-opener rule until day38mre
  • b011f98eRecords: style form live on day35mre
  • 60d90cb2Records: L1 woken for the restartmre
  • 75ae544fRecords: restart waits for the connection to closemre
  • e0b75951Records: L1 merged and pushed, restart waits for an open connectionmre