feat(Paging): extract paging into standalone reusable component#128
Merged
Conversation
- Create Paging component from ReadOnlyGrid inline paging UI - Refactor ReadOnlyGrid to use the new Paging component - Add stories with autodocs, args-based controls, and interactive render Closes pglevy#108
pglevy
requested changes
May 28, 2026
- Remove startIndex, endIndex, totalPages from public props - Add pageSize prop; compute totalPages, startIndex, endIndex internally - Update ReadOnlyGrid to pass simplified props - Simplify stories to match new API Addresses PR pglevy#128 review feedback
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 #108
Summary
Extracts the inline paging UI from
ReadOnlyGridinto a standalonePagingcomponent for easier reuse across grids, lists, and card layouts.Changes
src/components/Paging/Paging.tsx— Standalone paging component with props forstartIndex,endIndex,totalCount,currentPage,totalPages,pagingControls,onPageChange, andshowWhensrc/components/Paging/Paging.stories.tsx— Stories with autodocs, args-based controls, and interactive render (Standard, RowCount, TwoPages)src/components/Paging/index.ts— Barrel exportsrc/components/ReadOnlyGrid/ReadOnlyGrid.tsx— Replaced ~40 lines of inline paging UI with<Paging />usage; removed unused importssrc/components/index.ts— Addedexport * from './Paging'Props
startIndexnumberendIndexnumbertotalCountnumbercurrentPagenumbertotalPagesnumberpagingControls'STANDARD' | 'ROW_COUNT''STANDARD'onPageChange(page: number) => voidshowWhenbooleantrueBehavior
STANDARDROW_COUNTtotalPages >= 3Component returns
nullwhentotalPages <= 1.Screenshots
Standard (pagingControls="STANDARD")
Row Count (pagingControls="ROW_COUNT")
Two Pages (ROW_COUNT, no first/last buttons)
Testing
tsc --noEmit)vite buildsuccess