Skip to content

feature: expose GalleryItem#6

Merged
marlonmarcello merged 4 commits into
mainfrom
feature/split-gallery-item
Jul 13, 2023
Merged

feature: expose GalleryItem#6
marlonmarcello merged 4 commits into
mainfrom
feature/split-gallery-item

Conversation

@marlonmarcello
Copy link
Copy Markdown
Member

@marlonmarcello marlonmarcello commented May 25, 2023

Goal

Right now there is no way to target the <li> item that is auto generated and wrapped around the render function. So trying to customize it while using CSS modules require the use of the :global mixin.

The goal of this PR is to expose the <GalleryItem /> component to allow for further customization of the automatically rendered <li> tag.

This is a breaking change so I bumped the version to 2.0.0.

Usage

Not much changes, only things is that now users need to return a <GalleryItem /> component inside their render function:

<Gallery items={GALLERY_ITEMS}>
    <GalleryMain
      renderGalleryItem={({ item, i, active }) => (
        <GalleryItem key={i} index={i} active={active}>
          <img src={item.image} alt={item.alt} />
        </GalleryItem>
      )}
    />
</Gallery>

@marlonmarcello marlonmarcello self-assigned this May 25, 2023
@marlonmarcello marlonmarcello added the enhancement New feature or request label May 25, 2023
liamegan
liamegan previously approved these changes May 25, 2023
Copy link
Copy Markdown
Member

@liamegan liamegan left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewrubin
Copy link
Copy Markdown
Member

This works for me! Thanks for the update. Do you mind updating the docs as well? No rush.

If this is not urgent, I think we should prep a release before merging this to main, which also includes a fix to #3.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
@marlonmarcello marlonmarcello force-pushed the feature/split-gallery-item branch from c968d7a to 5aff3eb Compare July 13, 2023 00:22
@marlonmarcello marlonmarcello merged commit 2f09d47 into main Jul 13, 2023
@marlonmarcello marlonmarcello deleted the feature/split-gallery-item branch July 13, 2023 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants