-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(component): create basic pagination component #188
feat(component): create basic pagination component #188
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple more things:
- Write some unit tests for your new feature.
- You'll need to add a documentation page so you can show how to use your component as well as what props are being passed and how they are useful. See PAGES.md for the structure and layout of the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some screenshots to the PR description 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, but looking really good!
} | ||
|
||
setItemRange([firstItemInRange, lastItemInRange]); | ||
}, [currentPage, currentRange, totalItems]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but if totalItems
changes, maxPages
will not update. So with that in mind, you'll maybe want to have another useEffect
listening to only totalItems
and update it whenever that changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the state of currentPage
is dependent on totalItems
and currentRange
props, it should/does change dynamically without the need for a useEffect
listener (at least, that has been my experience with the component). We may need to look at messing around with this to be certain though.
WHAT
Created Pagination component to be used with lists and tables
TESTING
jest testing
SCREENSHOTS