-
Notifications
You must be signed in to change notification settings - Fork 161
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
API: swap naturalSlideWidth and naturalSlideHeight for ratio #95
Comments
naturalSlideWidth
and naturalSlideHeight
for ratio
@mvasin I understand where you are coming from. We looked at it more from the point of view of people using the component. People generally know or have the size of the images that will be in the carousel. We felt overall It is easier for a human to put those numbers in and do the math for them, then to have them figure out the ratio, including things like repeating, rounding, decimals, etc. Overall, I don't think we see the benefit in making a major breaking change in removing the height and width in favor of just a ratio. Is there a problem you are encountering using height and width that ratio would solve? |
I can understand why you think this might be an improvement but as someone who has had to support this project, you'd be amazed how hard it is to explain the concept of "aspect ratio" to some people. If I did change the name, I'd change it to aspectRatio and not ratio, because that is a more accurate and self-documenting variable name. "Self documenting variable names" is computer programing concept that predates React. The natural width and natural variable names were chosen because that's what people see when they hover their mouse over an image in Chrome dev tool. The hopes were that people would be able to grasp on to this easier than fractions converted to decimals. So while in some respects, I do agree with you, I say "why make people do the math manually" when the computer can do it for you, and far more accurately. Problems with ratio:
|
When I started reading the readme, it looked to me that I'm given two values so I can specify something like
@tim-steele The biggest trouble with these props for for me is the need to specify them in the first place, see #94. It doesn't relate really, but why not to clean up. I'm OK if you won't. @mrbinky3000 My primary use case most of the time is using images of various resolutions with Well, that's perfectly fine that your original use case does not mirror mine. I don't mind if you'll stick to what's already there, but why not to fix these three confusions:
|
@mvasin Maybe our documentation/README is a little confusing and we could provide a better explanation as to what these are and why they matter, and even provide an additional call out just for the aspect ratio. Let us look into this a bit more. |
@tim-steele I exaggerate a bit, I don't say I actually had those questions, I mean these three points are the source of potential confusion that could be avoided with deprecating |
@mvasin I think your point about it being a source of potential confusion is valid. I am not sure if Thanks for bringing this to our attention. |
I'd like to add another use case that I feel is relevant to this discussion. I'm building a slider with picture elements which I use for art-direction. This means that the aspect ratio changes depending on the viewport size. Of course, it's possible to change naturalWidth/Height at the same breakpoints but that would probably be a bit cumbersome to implement and I'm not sure if there's even a general approach that would work for all of the many things you can do with the picture element. Also, it always feels a little iffy to mix styling with logic although I realize that's always particularly challenging with carousels. Ideally, I feel like the picture element should be a "first-class citizen" that's supported by a modern carousel. Again, I understand that that's probably quite challenging in reality. Of course, this discussion also extends to the general case where the slides change aspect ratio depending on the viewport - especially when the slides contain content other than images. One common example, I'd imagine, is a testimonial slider. While you'd probably want each testimonial/slide to be the same height to avoid a janky/jumpy layout, you might want to change the aspect ratio on smaller screens due to the text being taller. |
I have the same problem as above... I removed owl for this and I love it. Unfortunately I have dynamic text below my image and also need to know how to handle it.
I disagree with this. This is a powerful carousel. It shouldn't be relegated to someone with fixed images of a specific size. |
I have a pretty nice example for being able to dynamically show different size slides. In my case I am doing blog posts (articles). I have just implemented it with actually a data driven group of carousels. I shortened an example project to just do one carousel for anyone that needs this functionality. |
I don't know if you still need this ability but I created a nice site using it. |
@cyphire we are open to it if you want to do a draft pull request for review? |
Why would you specify two parameters that boil down to a single number anyway? It's a confusing redundancy.
Sure, it can help cut a line of code when using the library, but react docs mention that
and it makes sense to me.
So if the
CarouselProvider
component doesn't care about the values, and only cares about the ratio between the values, let's call the propratio
and deprecatenaturalSlideWidth
/naturalSlideHeight
.The text was updated successfully, but these errors were encountered: