-
Notifications
You must be signed in to change notification settings - Fork 97
feat: renames Pagination to OffsetPagination with revised API #1712
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
4090241 to
78beead
Compare
78beead to
10b9bda
Compare
10b9bda to
7a5e57f
Compare
7a5e57f to
d896ca1
Compare
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.
There should be a migration.md entry for the rename, type extend change, and prop update.
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.
File should be named offsetPagination.stories.mdx (lowercase "o") for consistency with others.
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.
[nit] let's nab this one before merge ☝️
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.
Dang. I really thought I pushed this one up. 🤦🏻
| GapComponent, | ||
| props, | ||
| 'aria-label', | ||
| 'Ellipsis indicating non-visible pages' |
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.
Is it worth passing a size prop to the gap component so that this default label can be customized with "Ellipsis indicating ${size} non-visible pages"? Certainly non-essential; perhaps nice to have.
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 that idea. Looks like the calculation is all there already, too.
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.
Actually, the calculation is a bit more involved than I thought. Definitely something to consider in the future though.
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.
Ok, I'm totally fine to defer. But we'll probably need to punt to a future major, because we'd want the labels API to follow suit with a function.
| labels: { | ||
| gap: 'Ellipsis indicating non-visible pages', | ||
| page: p => `Page ${p}`, | ||
| next: 'Next page', | ||
| previous: 'Previous 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.
Not sure, due to the type mix. But can this be setup so it can be controlled via the story?
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.
Perhaps we could flatten this object & define some argTypes for it, then re-form the labels object in the Story render function?
| return css` | ||
| min-width: ${height}; | ||
| max-width: ${math(`${height} * 2`)}; /* [1] */ | ||
| max-width: ${math(`${height} * 2`)}; |
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.
Should we get rid of the expensive math function by making height a number calculation and appending 'px' where necessary?
| * @param {string} pageType The type of the page accepting the props | ||
| * @param {any} props Default page props to transform | ||
| * @param {number} pageNumber The page number | ||
| * Provides localized labels to pagination elements. |
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.
| * Provides localized labels to pagination elements. | |
| * Provides localized labels to pagination elements |
[nit] no period, per content guidelines
0fcab89 to
2817a53
Compare
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.
[nit] let's nab this one before merge ☝️
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 slight content change suggestion in addition to the file rename request 🙏
Co-authored-by: Jonathan Zempel <jzempel@gmail.com>
Description
OffsetPagination(renamedPagination) with API and accessibility improvements.Detail
transformPagePropsprop has been removedlabelsprop added to more simply customize pagination element labelscontainer-paginationremoved (no arrow key navigation removed + hook-provided attributes restored in its place)navtag with translatablearia-label.aria-labelrecommended for ellipsis/page gap elementbuttonsaria-current="page"Page X(currentword removed).Checklist
👌 design updates will be Garden Designer approved (add the designer as a reviewer)npm start)?bedrock)