FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
3.06k stars 593 forks source link

fix: make cellAlign Center work correctly #901

Closed hsource closed 2 years ago

hsource commented 2 years ago

Description

The logic for cellAlign={Alignment.Center} was incorrect, and was leading to slides not being centered. The most common case is to center-align the slides when we display 1.5 or 2.5 slides. In that case, the left margin should be just 0.25 of a slide to make sure the slides are centered.

Type of Change

Please delete options that are not relevant.

How Has This Been Tested?

This was tested with the new Storybook stories:

Alignment

Checklist: (Feel free to delete this section upon completion)

vercel[bot] commented 2 years ago

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

Name Status Preview Updated
nuka-carousel ✅ Ready (Inspect) Visit Preview Jun 4, 2022 at 10:45PM (UTC)
hsource commented 2 years ago

I updated this and added new Storybook stories to make the behavior match v1. It should work well now!

hsource commented 2 years ago

@ValGeorgiev ready for review/merge

ValGeorgiev commented 2 years ago

I tested it locally and run the cypress tests as well. All good. Thanks for this fix

ValGeorgiev commented 2 years ago

This should be in nuka-carousel@5.1.2