-
Notifications
You must be signed in to change notification settings - Fork 164
Add variableHeight argument to CarouselProvider that disables the ratio #243
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
Conversation
Generally, if it can be handled via CSS, then I'm against adding new props to the components. But this seems to be a recurring theme with the height so I relent. I have some requests though... Can you add an example to our list of live demos? I want to download the branch and see the demo so I can see how this affects a vertical carousel? If one slide is 1000px in height, does that mean all slides are 1000px in height or are there "gaps" where the background will bleed through. Have you looked at flex-box instead. It will make all slides as tall as the tallest slide. Is there an option for "variable width" on vertical carousels? I might want to change the name to useIntrinsicDimension or intrinsicAxisSize or something more descriptive because "variable height" to me sounds like responsive height, and the carousel is currently responsive as is. Might be confusing to others. I'm getting the Axis concept from flex-box. |
@mrbinky3000 Currently they do not flex to all become the same height. I haven't looked into the width case, so currently there is no such option, it shouldn't be too hard to add though. Open for renaming, haven't put too much thought into that. |
Looking at the The width of the whole slider currently scales to 100% of the container, in both vertical and horizontal arrangement. Based on that width, all the other sizes are calculated. With that being said: |
` # Please enter the commit message for your changes. Lines starting
Can you add the error for using this new flag in vertical mode? Also can we change the name of the option to "isIntrinsicHeight". We use "is[blank]" for booleans. Also the word "use" implies a hook. Make those changes and I will approve. |
isIntrinsicHeight in vertical orientation
Let me know if the Error message is ok the way it is, or if you want to have something added :) |
It's all good, thanks! |
Thanks for this! |
when release ? :) thanks for this package |
@allcontributors please add @reckter for code |
I've put up a pull request to add @reckter! 🎉 |
🎉 This PR is included in version 1.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Add a
variableHeight
attribute toCarouselProvider
.If set to true, the Slider will not adhere to the ratio being set with
naturalSlideHeight
andnaturalSlideWidth
.The Slider will have the height of the biggest Slide.
Why:
So you can use non scaling context (like text on the slide).
Without these changes, the Slide would be either too small or too big (and just clip the Slide in half).
This somewhat addresses the issues in the following issues. This does not however change the hide of the Slider depending on the current shown slide, which might be another cool addition.
auto
? #225How:
We store
variableHeight
in the store inCarouselProvider
.Each
Slide
then sets styles depending on that.The styles Reset the
position
,height
andpadding-bottom
css attributes, which allows the Slider to be as heigh as the biggest Slide, therefore dynamicaly scalling with the content.Checklist:
As this is my first change in the library, it might be wise to do a bit further testing, as I might have missed some egde cases.
But it feels very good, and all test pass.
Workaround
This can be archived "from the outside" by using these css rules: