Skip to content
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

DSD-1888: Pagination style updates #1720

Open
wants to merge 13 commits into
base: development
Choose a base branch
from

Conversation

7emansell
Copy link
Collaborator

@7emansell 7emansell commented Jan 3, 2025

Fixes JIRA ticket DSD-1888

This PR does the following:

  • Updates the style of the Pagination component, particularly the Previous and Next links

How has this been tested?

Accessibility concerns or updates

Accessibility Checklist

  • Checked Storybook's "Accessibility" tab for color contrast and other issues.
  • The feature works with keyboard inputs including tabbing back and forward and pressing space, enter, arrow, and esc keys.
  • For hidden text or when aria-live is used, a screenreader was used to verify the text is read.
  • For features that involve UI updates and focusing on DOM refs, focus management was reviewed.
  • The feature works when the page is zoomed in to 200% and 400%.

Open Questions

Checklist:

  • I have updated the Storybook documentation and changelog accordingly.
  • I have added relevant accessibility documentation for this pull request.
  • All new and existing tests passed.

Front End Review:

  • Review the Vercel preview deployment once it is ready.

Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nypl-design-system ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 6:25pm

Copy link

github-actions bot commented Jan 3, 2025

Your pull request is missing a changelog—was that intentional?

@@ -123,76 +125,156 @@ export const Pagination: ChakraComponent<
handlePageClick(e, nextPageNumber);
}
};

// Returns the "Previous" or "Next" link element, disabled according to current page number.
const previousNextElement = (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of styling added here since this element is a weird halfway point between a Button and a Link. Should this be moved to theme/pagination.ts or is it okay here since the item elements also have their styling in this file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where my comment went... but yes, do try moving this into the pagination.ts file. I think it'll work best if it's a new theme object within the same file so you can use useMultiStyleConfig again but with a different value.

This element also seems like one you can remove from this main component and a create a new component in this same file (or it can be a different file).

If it is moved to pagination.ts, will the arguments need to be passed in the useMultiStyleConfig function? That seems like the trickiest part to implement without taking a very close look.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This element also seems like one you can remove from this main component and a create a new component in this same file (or it can be a different file).

I would but I think it also makes sense for it to parallel getItemElement() ? Now that the styling is in the theme file too it's not as long

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, let me know if this is what you were thinking for the theme file. It works but I always feel like I'm missing something when I use defineMultiStyleConfig

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the theme file looks good. The usage of defineMultiStyleConfig is also fine and nothing is missing.

src/components/Pagination/Pagination.tsx Outdated Show resolved Hide resolved
src/components/Pagination/Pagination.tsx Outdated Show resolved Hide resolved
src/components/Pagination/Pagination.tsx Outdated Show resolved Hide resolved
Comment on lines 177 to 180
{...{
"aria-label": `${isPrevious ? "Previous" : "Next"} page`,
"aria-disabled": isDisabled,
}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these added as spread props? It looks like theyre always added so you can add them directly to the component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just sloppy– i was initially using linkAttrs from the item element and then got rid of it

{text}
</Text>
)}
<Icon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's technically correct to render both svgs since they're both hidden from screenreader and, depending on which one is rendered, the other one is visually hidden. It just feels wrong looking at the code since you have to pay more attention to the CSS hiding the component than a logic statement. Nothing to do, just pointing out something nitpicky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants