feat: add Pagination component - #23
Open
patrickkuei wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11
Summary
Paginationcomponent: a cyberpunk-styled page control for list/table views with more results than fit on one page, always controlled viacurrentPage/totalPages/onPageChange.compact(defaulttrue) collapses distant page numbers behind an ellipsis using a standard boundary/sibling-window algorithm (siblingCount/boundaryCount, both tunable), falling back to rendering every page when the total already fits —compact={false}forces the full list regardless of count.variant(primary/secondary/accent) reuses Button/Badge/Tooltip's existing palette vocabulary for the active-page highlight and hover glow rather than inventing new colors. Page/Previous/Next controls are plain native<button>s in normal tab order (not a roving-tabindex widget, since pagination isn't a single-selection group the way RadioGroup/Accordion are) witharia-current="page"on the active page;Home/Endjump to the first/last page from anywhere inside the control as an added convenience.currentPage/totalPages/onPageChange, compact ellipsis mode for large page counts, prev/next controls, responsivesize, neon active-page highlight with hover glow matching Button/Badge) is covered in this PR.Changes
Pagination(src/components/Pagination.tsx) —currentPage,totalPages,onPageChange,compact,siblingCount,boundaryCount,showPrevNext,variant, responsivesize,disabled,ariaLabel,className.paginationentry toRESPONSIVE_SIZE_MAPSinsrc/utils/responsive.ts.Pagination/PaginationPropsfromsrc/components/index.ts.Pagination.stories.tsx): Default (controlled demo), Secondary, Accent, Sizes, Disabled, CompactCollapsing (200-page archive), ExpandedMode (compact={false}), NoPrevNext, Controlled, and an AllVariants render story (cyberpunk copy throughout, e.g. "Loading archive shard 3 of 30…").Pagination.test.tsx, 17 cases): renders without crashing, full page list for small totals,aria-current="page"wiring, page-clickonPageChange, no-op click on the already-current page, controlled behavior (state only changes when the prop does), Previous/Next click advancing/retreating, Previous/Next disabled at the boundaries,showPrevNext={false}omits the controls, ellipsis collapsing for large totals, full list withcompact={false}, customsiblingCount/boundaryCount,Home/Endkeyboard jumps, disabled state blocks every control, renders nothing fortotalPages < 1, customariaLabel/className, responsivesize.Paginationintoscripts/generate-manifest.js(CATEGORY_MAP→ Navigation, alongsideDropdownMenu;DOC_SUMMARIES) and regenerated docs vianpm run docs:generate— diff reviewed, onlyPagination-related lines changed.[Unreleased].Test plan
Generated by Claude Code