-
Notifications
You must be signed in to change notification settings - Fork 615
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
STENCIL-2455: Prevents carousel images from being cut off on large sc… #909
Conversation
Autotagging @mcampa @bc-miko-ademagic @davidchin |
We could add a toggle in the Theme Editor to enable this feature 🍹. Something like:
This way people won't complain about their images being too stretched. To add the checkbox add a new setting to the |
I actually had that same thought earlier @mcampa! I forgot to post it as a possible solution. I am comfortable making those code changes if that's what we think is best :) |
Added two checkboxes: |
@@ -745,6 +745,18 @@ | |||
"name": "Carousel", | |||
"settings": [ | |||
{ | |||
"type": "checkbox", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this being used ? I do not see any corresponding template change to support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
templates/components/carousel.html
Outdated
@@ -9,7 +9,8 @@ | |||
}' | |||
> | |||
{{#each carousel.slides}} | |||
<div class="heroCarousel-slide" style="background-image: url({{image}})"> | |||
<div | |||
class="heroCarousel-slide" style="background-image: url({{image}})"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to move this to the next line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, that was a mistake. Fixing
@@ -75,8 +78,14 @@ | |||
} | |||
} | |||
|
|||
&.heroCarousel-slide-stretch .heroCarousel-slide { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to modify the appearance of a CSS selector, you should use --
instead of -
. Also I think this is unneccessarily nested. You can lower its specificity by moving it out. i.e.:
.heroCarousel-slide--stretched {
@include breakpoint("large") {
background-size: 100%;
}
}
And apply the modifier class directly to .heroCarousel-slide
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -83,6 +85,12 @@ | |||
background-size: cover; | |||
position: relative; | |||
|
|||
&.heroCarousel-slide--stretch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the change! heroCarousel-slide--stretch
doesn't need to be nested in heroCarousel-slide
. Just move the former below the latter.
We are now using
|
Tested on an integration store 💚 |
…reens.
JIRA Ticket
https://jira.bigcommerce.com/browse/STENCIL-2455
What
Switches carousel background-size from "cover" to "100% 100%" which fits the entire image into the slide's viewing area.
Why
Carousel images are currently becoming cut off on the top and bottom at browser widths greater than 1261px.
Caveats
Images may look a bit stretched.
Screenshots
Before Change:
After Change: