gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitef253fecef253fecreports/F4-icons.mdmreef253fec/components/pagination/README.md

2.7 KB

  1. # Pagination
  2. Page numbers with Previous and Next, like `Previous 1 … 44 45 46 … 89 Next`. The first and the last page are always
  3. there, the current page with one neighbour each side; "…" stands for the pages left out (a gap of one page shows that
  4. page instead). At the start it shows `1 2 3 4 … 89 Next`, at the end `Previous 1 … 86 87 88 89`. Previous is missing on the
  5. first page, Next on the last. The current page is filled with the accent colour (black without a theme).
  6. Live demo: https://components.hybriel.worldapi.org/pagination
  7. ## Use it in an app
  8. Copy the folder `components/pagination/` (`pagination.hl`) (optionally `shared/tokens.hl` for the app's own accent; it carries its own `Style`), then compose it into a
  9. page and say how many pages there are:
  10. ```
  11. import Pagination from './pagination.hl'
  12. View {
  13. Pagination { pages = 89 }
  14. }
  15. ```
  16. - No script needed. One pagination per page (a composed component's members are the page's state, COMPONENTS.md §12).
  17. - `previousLabel` / `nextLabel` are the button texts (default `Previous` / `Next`).
  18. - Colours are the semantic tokens only, each with a black/white/grey fallback: the base look is black, white and greys (no frames; root README "Look"); an app that declares the WorldAPI tokens (layouts.worldapi.org's theme) restyles it (the current page: white on black).
  19. ## Data out (ticket #16)
  20. Hand the pagination a function; every click calls it with the page the click goes to:
  21. ```
  22. import Pagination from './pagination.hl'
  23. import { navigate } from 'hl:web'
  24. page = 1
  25. pages = 89
  26. goPage = (to) => { navigate('/list/page/' + to) } // or: load page `to` into this page's members
  27. View {
  28. Pagination { pages = pages page = page onPage = goPage }
  29. }
  30. ```
  31. - `onPage(to)` runs on every click that changes the page — pointer, keyboard (Enter / Space on a focused button) or a script's
  32. `click()` — for Previous, Next, a number, the first and the last page; not for "…" and not for the current page. `to` is
  33. resolved against the page shown when the button was clicked, then the pagination shows `to` itself.
  34. - Why a function and not `emit`: a child's `emit` does not reach its host; the host hands it a function that writes the host's
  35. members (hybriel#87). Do NOT listen for clicks around the pagination and read a button's text: on a real click the pagination
  36. has already rebuilt its buttons when such a listener runs (tracker#38).
  37. - Each button carries its target page in `data-page` (`0` for "…").
  38. - Without `onPage` it only pages through itself.
  39. ## Markup and states
  40. `<pagination>` holds a `<nav>` with `<ol id="pagination-items">`; each entry is an `<li>` with a `<button>`: class `page`
  41. (the current one also `current`), `step` (Previous / Next), `gap` (the "…", a click does nothing). Narrow
  42. screens: the buttons wrap onto a second line.

Branches

Latest commits

  • ef253fecreports/F4-icons.mdmre
  • ba96735ficons: README, md-editor README note, gate checks for the single focus ring and toolbar iconsmre
  • 96c97691icons: shared Icon component; md-editor toolbar and files-upload remove use it; no inner focus ring in md-editormre
  • 0d6863d6reports/F3-mdvalue.mdmre
  • d58ed98bMdEditor: an older text of the editor handed back is not an outside change (kept surface, written back); gate for itmre
  • c2d0de59MdEditor: show a value that changes from outside (data-value observer), demo button and gatemre
  • c4272fa3re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • 2e22618etests: cdp-blank/md-bg/md-keys-run Chrome range and base port from env (MDK_CHROME, MDK_PORT), defaults unchangedmre
  • a5d2384bre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • 52902d23docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
  • 022b943fdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • d17f8543mission 012: re-vendor Hybriel master f9614007 (plugins), fixes comments push redraw; gate 480/0mre
  • 5f95de05mission 012: re-vendor Hybriel ce6f2e0a (plugins), report: gate 478/2 on comments push redrawmre
  • 3794c591mission 011: report, LOG, STATUS, md-keys-run widths, cdp-blank helpermre
  • 77a93c16mission 011: gate hook for md-keys (480/0), flatten() runs one at a time (removeChild race), surface also built on first focus / pointer-down (background tab), md-bg test, README keysmre
  • 3c906718mission 011: md-editor key tests (real keys) and fixes: nested p/ul flatten, bare br, link change, Ctrl+E, code block exit (WIP)mre
  • 1442e583mission 010: report, LOG, STATUSmre
  • 6f27ad31md-editor: phone toolbar row contained (inline-size) so it never widens a grid parentmre
  • d702d76dmd-editor look: root class md-empty (a host .empty rule hit it), rows = surface height, one phone toolbar row with 44 px targets; comment form rows 3; gate 360/0mre
  • 15be2ac0comments: attach (FilesUpload pick), onPost(text, files), files per comment; md-editor files=off; README, gate fixmre