gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc545b642c545b642content-first: nest child and compound selectors in Stylemrec545b642/components/demo/mail-demo.hl

3.8 KB

  1. // components/demo/mail-demo.hl — `/shells/three-pane[/:id]`: SHELL 3 as a mock mail client, signed in. Phone: the message
  2. // list first, the folders are the sidebar overlay (header toggle); a message replaces the list, with its own actions and a
  3. // link back. Desktop: folders, list and message side by side.
  4. parent '../main.hl'
  5. import AppHeader from '../../theme/shell/app-header.hl'
  6. import UserMenu from '../../theme/shell/user-menu.hl'
  7. import Sidebar from '../../theme/shell/app-sidebar.hl'
  8. import ThreePane from '../../theme/shell/three-pane.hl'
  9. import { folders, mails } from '../../lib/mock.hl'
  10. id = null
  11. String view = id == null ? 'list' : 'detail'
  12. Hybrid boxes = folders
  13. Hybrid rows = listRows(id)
  14. Hybrid mail = mailOf(id)
  15. Boolean hasMail = id != null
  16. Boolean welcome = id == null
  17. String acted = ''
  18. __title = 'Three-pane demo · WorldAPI layouts'
  19. listRows(at) {
  20. out = []
  21. for (m of mails) { out.push({ href = '/shells/three-pane/' + m.id from = m.from subject = m.subject date = m.date cls = (m.id == at ? 'selected ' : '') + m.unread aria = m.id == at ? 'page' : 'false' }) }
  22. return out
  23. }
  24. mailOf(at) {
  25. for (m of mails) { if (m.id == at) { return m } }
  26. return { id = '' from = '' subject = '' date = '' unread = '' body = [] }
  27. }
  28. Style {
  29. mailDemo {
  30. mailFrom {
  31. display = 'flex'
  32. justifyContent = 'space-between'
  33. gap = '.5rem'
  34. fontSize = '.9rem'
  35. color = 'var(--color-text-muted)'
  36. span {
  37. firstChild {
  38. minWidth = '0'
  39. overflowWrap = 'anywhere'
  40. }
  41. lastChild {
  42. flex = '0 0 auto'
  43. whiteSpace = 'nowrap'
  44. }
  45. }
  46. }
  47. mailSubject {
  48. display = 'block'
  49. overflowWrap = 'anywhere'
  50. }
  51. aside {
  52. // No language form for the existing class or attribute compound.
  53. 'a.unread' {
  54. mailSubject {
  55. fontWeight = '700'
  56. color = 'var(--color-text-strong)'
  57. }
  58. }
  59. }
  60. appSidebar {
  61. nav {
  62. a {
  63. display = 'flex'
  64. justifyContent = 'space-between'
  65. span { color = 'var(--color-text-muted)' }
  66. }
  67. }
  68. }
  69. output {
  70. display = 'block'
  71. marginBottom = '1rem'
  72. color = 'var(--color-success)'
  73. }
  74. }
  75. }
  76. View {
  77. mailDemo { on click(e) { emit mailAction(e) }
  78. AppHeader { brand = "Mail (demo)" brandHref = "/shells/three-pane" search = "/search" searchPlaceholder = "Search mail…"
  79. UserMenu { name = "Signed in as az5b2 (mock)"
  80. a { href = "/shells" "Settings" }
  81. a { href = "/shells" "Logout" }
  82. }
  83. }
  84. ThreePane { view = view
  85. Sidebar {
  86. nav { 'aria-label' = "Folders"
  87. h2 { "Folders" }
  88. for (f of boxes) { a { href = "/shells/three-pane" f.label span { f.count } } }
  89. }
  90. nav { 'aria-label' = "Showcase"
  91. h2 { "Showcase" }
  92. a { class = "back" href = "/shells" "‹ Shells" }
  93. }
  94. }
  95. aside { 'aria-label' = "Inbox"
  96. ul { for (r of rows) { li { a { href = r.href class = r.cls 'aria-current' = r.aria mailFrom { span { r.from } span { r.date } } mailSubject { r.subject } } } } }
  97. }
  98. main {
  99. if (welcome) {
  100. h1 { "Inbox" }
  101. p { class = "muted" "Pick a message. (A phone never shows this text: it opens on the list.)" }
  102. }
  103. if (hasMail) {
  104. a { class = "back" href = "/shells/three-pane" "Inbox" }
  105. menu { 'aria-label' = "Message actions"
  106. li { button { type = "button" value = "Replied" "Reply" } }
  107. li { button { type = "button" value = "Forwarded" "Forward" } }
  108. li { button { type = "button" value = "Archived" "Archive" } }
  109. li { button { type = "button" class = "danger" value = "Deleted" "Delete" } }
  110. }
  111. output { acted }
  112. h1 { mail.subject }
  113. p { class = "muted" mail.from " · " mail.date }
  114. article { for (t of mail.body) { p { t } } }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. // the actions are mock: they only say what they would have done
  121. on mailAction(e) {
  122. b = e.target.closest('menu button')
  123. if (b != null) { acted = b.value + ' (mock — nothing happened)' }
  124. }

Branches

Latest commits

  • c545b642content-first: nest child and compound selectors in Stylemre
  • eae2be7aapp-sidebar: nest child selectors and document caller-slot gapmre
  • 69c9f784Record LY7 slot nesting blocker and minimal repromre
  • b1d4f379app-header: nest child and compound selectors in Stylemre
  • 6385ff8eRecord LY7 style formatting proof and review statusmre
  • 0100f51etracker-demo: format Style with nested rules and bare mediamre
  • 5f82554enotes-demo: format Style with nested rules and bare mediamre
  • 3dc27d78mail-demo: format Style with nested rules and bare mediamre
  • cf9648afhome: format Style with nested rules and bare mediamre
  • 846a6242user-menu: format Style with nested rules and bare mediamre
  • 4d58708cthree-pane: format Style with nested rules and bare mediamre
  • 0bbfc553main-menu: format Style with nested rules and bare mediamre
  • 7755199dlist-first: format Style with nested rules and bare mediamre
  • 35199303content-first: format Style with nested rules and bare mediamre
  • 00f6e698app-sidebar: format Style with nested rules and bare mediamre
  • bb2f29c9app-header: format Style with nested rules and bare mediamre
  • 3aca2d7fSync components from 8176eb1 with reviewed nested stylesmre
  • 87e4003dRe-vendor layouts to Hybriel set day35mre
  • d8628cfflayouts: a startup error prints its message before exit 1 (hybriel#247)mre
  • 180fd76elayouts: MdEditor from components 59704ce (text on the clipboard always pastes, a file manager copy still attaches; pipe rows; empty Table-button table; tickets#49, notes#5)mre