Skip to content

Align pagination to architecture goals#181

Open
lifeiscontent wants to merge 3 commits into
mainfrom
align/pagination
Open

Align pagination to architecture goals#181
lifeiscontent wants to merge 3 commits into
mainfrom
align/pagination

Conversation

@lifeiscontent

Copy link
Copy Markdown
Collaborator

Closes #141

What the spec says

From the designer's comment on #141:

Always the same (baked in): horizontal layout, prev/next button positions, active page highlight, gap between items, ellipsis for collapsed ranges, focus ring, keyboard navigation, disabled prev/next at bounds.

Depends (adjustable): total pages, current page, visible page range, size variant, whether first/last page buttons are shown, whether a page count summary is shown.

Changes

variants.ts

  • Removed cx import entirely; the slotBase shared base is now an internal string constant (not exported).
  • Each cva (pageButtonVariants, arrowButtonVariants, ellipsisVariants, perPageTriggerVariants) now carries a magnitude variant with an initial md value for the current 24 px Figma size — no defaultVariants, so the prop is required at each call site.
  • Added ellipsisVariants as a proper cva so the ellipsis component never calls cx directly.
  • Switched [&_svg] descendant selectors to [&>svg] direct-child selectors, matching the single-element / children-passed-in pattern.

pagination-ellipsis.tsx

  • Removed baked <MoreHorizontal> icon. The part now accepts children and sizes whatever svg is passed via [&>svg]:size-3.5 — the same NodeSlot pattern used by the arrow button. This keeps the part to one rendered element.
  • Removed the cx import.

pagination-arrow-button.tsx, pagination-page-button.tsx, pagination-per-page-trigger.tsx

  • Each now requires magnitude: PaginationMagnitude. Callers must be explicit about size; no silent default.

index.tsx (ui/pagination)

  • Replaced slotBase export with ellipsisVariants and PaginationMagnitude.

components/pagination/pagination.tsx

  • All four ui part call sites pass magnitude="md".
  • PaginationEllipsis now receives <MoreHorizontal aria-hidden /> as children.

Stories

  • Both story files updated to pass magnitude="md" and supply the ellipsis icon as children.

Notes

  • Visuals are unchanged; this is a structural alignment.
  • The magnitude variant has one value today (md). Additional sizes (e.g. sm) can be added to variants.ts and surfaced through the composition layer without breaking the existing API.
  • Needs design approval from @bhaveshraja before merging per the project's review process.

@github-actions

Copy link
Copy Markdown

📚 Storybook preview: https://pr-181-propel-storybook.vamsi-906.workers.dev

- Move all className composition into cva variants; drop cx from component
  files and from the exported slotBase helper (now an internal constant).
- Add ellipsisVariants cva so PaginationEllipsis no longer calls cx directly.
- Make PaginationEllipsis accept children (NodeSlot pattern) instead of baking
  MoreHorizontal inline, keeping it a single rendered element.
- Add required magnitude prop to every ui part (PaginationArrowButton,
  PaginationPageButton, PaginationEllipsis, PaginationPerPageTrigger) with
  an md value covering the current 24px Figma size; no defaultVariants.
- Switch [&_svg] descendant selectors to [&>svg] direct-child selectors to
  match the single-element/children-passed-in pattern.
- Export PaginationMagnitude and ellipsisVariants from the ui entry; drop
  the now-internal slotBase from the public export.
- Thread magnitude="md" through the Pagination composition and both story
  files.
…ts tier

Each ui/pagination part now renders exactly one element: add the
Pagination (nav), PaginationList, PaginationItem, PaginationPerPage,
PaginationPerPageIndicator, PaginationPerPageLabel, PaginationRange,
PaginationRangeCurrent and PaginationSpinner parts, and turn the ellipsis
into an icon slot. The components tier composes these parts and no longer
carries any className/cva/cx. Drop the single-value magnitude axis (the
24px Figma slot is the only size, so it's baked in).
…ames

Rename every cva export in ui/pagination/variants.ts (and all consumer
files) so each name is exactly <camelCasePartName>Variants per rule 3a:
pageButtonVariants → paginationPageButtonVariants
arrowButtonVariants → paginationArrowButtonVariants
ellipsisVariants → paginationEllipsisVariants
spinnerVariants → paginationSpinnerVariants
perPageVariants → paginationPerPageVariants
perPageTriggerVariants → paginationPerPageTriggerVariants
perPageIndicatorVariants → paginationPerPageIndicatorVariants
perPageLabelVariants → paginationPerPageLabelVariants
rangeVariants → paginationRangeVariants
rangeCurrentVariants → paginationRangeCurrentVariants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination: what should always look the same, and what should be adjustable?

1 participant