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

Fix pagination bugs and refactor/abstract styling logic #205

Merged
merged 7 commits into from
Oct 9, 2023

Conversation

delbaoliveira
Copy link
Collaborator

@delbaoliveira delbaoliveira commented Oct 9, 2023

This PR fixes the pagination bugs:

  1. We were using pointer-events-none to disable arrows for the first and last pages, but this only disables mouse events - keyboard users could navigate to page=0 or page=totalPages + 1. This PR truly disables them by rendering a <div> instead of a <Link>. It also means we're not passing a href to disabled links.
CleanShot 2023-10-09 at 13 32 56@2x
  1. Fixes hover states. Removes hover state on active items, removes hover state on disabled items.
  2. Disable ellipsis.
  3. Fixes border styles.
CleanShot 2023-10-09 at 14 03 47@2x
  1. Fix bug where you could not click on subsequent pages if a search term existed (since the page would always default to 1)

I've also extracted away the logic into separate components to make it easier for the user to update the <Pagination> component.

@vercel
Copy link

vercel bot commented Oct 9, 2023

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

Name Status Preview Comments Updated (UTC)
next-learn-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 2:42pm
next-learn-starter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 2:42pm
next-seo-starter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 2:42pm

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@delbaoliveira delbaoliveira changed the title Fix pagination bugs and refactor styling logic Fix pagination bugs and refactor/abstract styling logic Oct 9, 2023
Comment on lines +7 to +9
searchParams?: {
query?: string;
page?: string;
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 is not related, just cleaning up TS.

@delbaoliveira delbaoliveira merged commit 728368d into main Oct 9, 2023
6 checks passed
@delbaoliveira delbaoliveira deleted the example-7gfi branch October 9, 2023 15:59
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