Skip to content

feat(PaginationItem): Expose the gallery-pagination-item component#10

Merged
andrewrubin merged 6 commits into
mainfrom
fix/expose-pagination-item
Oct 23, 2023
Merged

feat(PaginationItem): Expose the gallery-pagination-item component#10
andrewrubin merged 6 commits into
mainfrom
fix/expose-pagination-item

Conversation

@Tiendongle
Copy link
Copy Markdown
Contributor

Description

A feature request to expose the Pagination Item render elements <li> and <button> to allow for easier styling and control.

Solution

  • Added a child render prop that returns index, active, activeIndex, and item props.
  • Exported <GalleryPaginationItem> component
    • Added props buttonClassname and buttonProps to pass to <button> element
    • Added prop onClick and call onClick prop in the handleClick()

Note

renderPaginationItem prop was retained and conditional is set to prevent breaking changes if the package is updated.

TODO

  • Document onClick callback

Existing issue mentioned: #7

Comment thread src/lib/components/gallery-pagination-item.jsx Outdated
Comment thread src/lib/components/gallery-pagination-item.jsx
Comment thread src/lib/components/gallery-pagination.jsx Outdated
Comment thread src/lib/components/gallery-pagination-item.jsx Outdated
Comment thread src/lib/components/gallery-pagination.jsx Outdated
Comment thread src/main.jsx Outdated
@Tiendongle Tiendongle force-pushed the fix/expose-pagination-item branch from ac80687 to 4fa320a Compare October 16, 2023 21:02
Copy link
Copy Markdown
Member

@andrewrubin andrewrubin left a comment

Choose a reason for hiding this comment

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

Some tiny docs changes and I think we'll be good to go!

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread src/lib/components/gallery-pagination.jsx Outdated
Comment thread src/lib/components/gallery-pagination.jsx Outdated
@andrewrubin andrewrubin self-requested a review October 23, 2023 21:18
Copy link
Copy Markdown
Member

@andrewrubin andrewrubin left a comment

Choose a reason for hiding this comment

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

Couple extra tweaks before we merge, lmk if anyone has any concerns:

  • Refactored the existing renderGalleryItem callback to use a property name of index instead of i. This matches the new renderPaginationItem convention.
  • Refactored all demos and documentation (existing and new) to use item.id as the key prop, as this is more in line with proper React conventions.
  • Bumped the package to 3.0.0

@marlonmarcello marlonmarcello self-requested a review October 23, 2023 21:34
@marlonmarcello
Copy link
Copy Markdown
Member

:shipit:

@andrewrubin andrewrubin merged commit 81d1988 into main Oct 23, 2023
@andrewrubin andrewrubin deleted the fix/expose-pagination-item branch October 23, 2023 22:27
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.

3 participants