-
Notifications
You must be signed in to change notification settings - Fork 881
feat: add pagination component to components directory #3295
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
Conversation
|
||
const styles = useStyles() | ||
|
||
const buildPagedList = () => { |
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.
I like to pull pure functions out of components as much as possible, maybe that can be done here? Then they can be unit tested easily, although I know you've tested the component, so it's up to you.
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.
Sure, I can take a stab at that!
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.
I have a diff opinion, I think it is easier to manage/find code by keeping them close to where they are used, and it looks like this function only will be used on this component so I would keep it in the component file but it is up to you.
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.
@presleyp @BrunoQuaresma I compromised here and added some unit tests but didn't separate the function from its component file so it should still be easy to find.
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.
Great! I think separating the function from the component is the important part.
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.
Nice work!
Resolves #3266
Here's an accessible pagination widget for the upcoming audit work (and for future pagination needs).

States
Unknown number of pages:

Less than 8 pages:

Many pages, user at the start:

Many pages, user in the middle:

Many pages, user at the end:
