gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commite631791be631791buser-menu: nest child and compound selectors in Stylemree631791b/components/demo/notes-demo.hl

2.5 KB

  1. // components/demo/notes-demo.hl — `/shells/list-first[/:id]`: SHELL 2 as a mock Notes app, signed in. On the phone `/`
  2. // shows only the list (its welcome text is never seen there); a note's route shows only the note, with a link back.
  3. // Desktop: list and note side by side; `/` shows the welcome text beside the list.
  4. parent '../main.hl'
  5. import AppHeader from '../../theme/shell/app-header.hl'
  6. import UserMenu from '../../theme/shell/user-menu.hl'
  7. import ListFirst from '../../theme/shell/list-first.hl'
  8. import { notes } from '../../lib/mock.hl'
  9. id = null
  10. String view = id == null ? 'list' : 'detail'
  11. Hybrid rows = listRows(id)
  12. Hybrid note = noteOf(id)
  13. Boolean hasNote = id != null
  14. Boolean welcome = id == null
  15. Boolean emptyNote = note.paragraphs.length == 0
  16. __title = 'List-first demo · WorldAPI layouts'
  17. // the list with the opened note marked
  18. listRows(at) {
  19. out = []
  20. for (n of notes) { out.push({ href = '/shells/list-first/' + n.id title = n.title updated = n.updated cls = n.id == at ? 'selected' : '' aria = n.id == at ? 'page' : 'false' }) }
  21. return out
  22. }
  23. noteOf(at) {
  24. for (n of notes) { if (n.id == at) { return n } }
  25. return { id = '' title = '' updated = '' paragraphs = [] }
  26. }
  27. Style {
  28. notesDemo {
  29. noteTitle {
  30. display = 'block'
  31. fontWeight = '600'
  32. color = 'var(--color-text-strong)'
  33. }
  34. noteUpdated {
  35. display = 'block'
  36. fontSize = '.85rem'
  37. color = 'var(--color-text-muted)'
  38. }
  39. noteFilter {
  40. display = 'block'
  41. padding = '.25rem .75rem .75rem'
  42. }
  43. }
  44. }
  45. View {
  46. notesDemo {
  47. AppHeader { brand = "Notes (demo)" brandHref = "/shells/list-first"
  48. UserMenu { name = "Signed in as az5b2 (mock)"
  49. a { href = "/shells" "Settings" }
  50. a { href = "/shells" "Logout" }
  51. }
  52. }
  53. ListFirst { view = view
  54. aside { 'aria-label' = "Notes"
  55. noteFilter { input { type = "search" placeholder = "Filter notes" 'aria-label' = "Filter notes" } }
  56. ul { for (r of rows) { li { a { href = r.href class = r.cls 'aria-current' = r.aria noteTitle { r.title } noteUpdated { r.updated } } } } }
  57. }
  58. main {
  59. if (welcome) {
  60. h1 { "Notes" }
  61. p { class = "muted" "Pick a note on the left. (A phone never shows this text: it opens on the list.)" }
  62. p { class = "links" a { href = "/shells" "‹ Shells" } }
  63. }
  64. if (hasNote) {
  65. a { class = "back" href = "/shells/list-first" "All notes" }
  66. h1 { note.title }
  67. p { class = "muted" "Updated " note.updated }
  68. article { for (t of note.paragraphs) { p { t } } }
  69. if (emptyNote) { p { class = "empty" "This note is empty." } }
  70. }
  71. }
  72. }
  73. }
  74. }

Branches

Latest commits

  • e631791buser-menu: nest child and compound selectors in Stylemre
  • 69604944three-pane: nest child and compound selectors in Stylemre
  • 3e389b83main-menu: nest child and compound selectors in Stylemre
  • 05413975list-first: nest child and compound selectors in Stylemre
  • 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