nuka-carousel
nuka-carousel copied to clipboard
feat: allow changing slides via a CarouselRef; add more className props
Description
- We want to advance/change the current slide of the carousel from a parent outside the carousel.
- To customize styling of the slider list and individual slides, we don't want to rely on the slider-list and similar classNames, as they're internal implementation details. Instead, we let users pass in their own classNames
- Make Carousel height update when only the slide itself changes without any props changing by using ResizeObserver (when available)
Type of Change
Please delete options that are not relevant.
- [X] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
Refs
Added new Storybook story that also includes contains buttons to change slide via the new refs:
Resizing on children change
Checklist: (Feel free to delete this section upon completion)
- [X] My code follows the style guidelines of this project (I have run
yarn lint) - [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes (I have run
yarn testandyarn test-e2e) - [X] I have performed a self-review of my own code
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published in downstream modules
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nuka-carousel | ✅ Ready (Inspect) | Visit Preview | Jan 28, 2024 3:25am | |
| nuka-carousel-website | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jan 28, 2024 3:25am |
@carlos-kelly @gksander - this PR lets parent components control the carousel with a ref. To make merging easier without rebasing, I just added 2 commits beyond what #909 has. Take a look after #909 if this seems useful to you! We'd love to get back onto mainline and not have to run with patches
@hsource we just merged two of your other PRs. Can you rebase with/merge in main and push up to this branch so we can see a better diff, and we'll get this reviewed soon! 🙏 Thank you for all of the awesome contributions!
@gksander - thanks! I've rebased and did a quick read of it just now. I think it's ready to review!
Hi, there is any progress on this PR? I'm meeting the issue with adaptive height. The carousel is stuck in zero height because adaptive height is calculated before the image load
@gksander Just a heads up - I rebased this, self-reviewed the code, and verified that the Storybook stories still work well. I updated the gifs of me testing the feature in the description.
@carloskelly13 too in case the ownership of this has changed! I saw you've been reviewing/pulling PR's lately.
Thanks again for the great package!
This is now supported in v8