-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Implement zero grid spacing and border collapsing #1464
base: main
Are you sure you want to change the base?
Changes from all commits
915c519
3b2ae47
709a770
ff01508
e35adf6
e30ccc8
38379cd
e6438a0
84773c1
66f0895
48ce135
fff395f
8bda150
e6d58cf
701ba35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,23 +21,23 @@ | |
grid-template-columns: repeat(2, minmax(0, 1fr)); | ||
} | ||
|
||
.collage--mobile .collage__item--left:nth-child(3n - 2) { | ||
.collage--mobile .collage__item--left:first-child { | ||
grid-column: span 2; | ||
} | ||
|
||
.collage--mobile .collage__item--left:nth-child(3n - 2):nth-last-child(2) { | ||
.collage--mobile .collage__item--left:first-child:nth-last-child(2) { | ||
grid-column: span 1; | ||
} | ||
|
||
.collage--mobile .collage__item--left:nth-child(3n) { | ||
grid-column-start: 2; | ||
} | ||
|
||
.collage--mobile .collage__item--right:nth-child(3n - 2) { | ||
.collage--mobile .collage__item--right:first-child { | ||
grid-column-start: 1; | ||
} | ||
|
||
.collage--mobile .collage__item--right:nth-child(3n - 2):last-child { | ||
.collage--mobile .collage__item--right:first-child:last-child { | ||
grid-column: span 2; | ||
} | ||
|
||
|
@@ -58,12 +58,12 @@ | |
grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
} | ||
|
||
.collage__item--left:nth-child(3n - 2) { | ||
.collage__item--left:first-child { | ||
grid-column: 1 / span 2; | ||
grid-row: span 2; | ||
} | ||
|
||
.collage__item--left:nth-child(3n - 2):last-child { | ||
.collage__item--left:first-child:last-child { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for updating this. I find this very readable now. 🙏🏻 |
||
grid-column: 1 / span 3; | ||
} | ||
|
||
|
@@ -76,12 +76,12 @@ | |
grid-row: span 2; | ||
} | ||
|
||
.collage__item--right:nth-child(3n - 2) { | ||
.collage__item--right:first-child { | ||
grid-column: 1 / span 1; | ||
grid-row: span 1; | ||
} | ||
|
||
.collage__item--right:nth-child(3n - 2):last-child { | ||
.collage__item--right:first-child:last-child { | ||
grid-column: 1 / span 3; | ||
} | ||
|
||
|
@@ -120,9 +120,9 @@ | |
box-shadow: var(--card-shadow-horizontal-offset) var(--card-shadow-vertical-offset) var(--card-shadow-blur-radius) rgba(var(--color-shadow), var(--card-shadow-opacity)); | ||
content: ''; | ||
position: absolute; | ||
width: calc(var(--card-border-width) * 2 + 100%); | ||
height: calc(var(--card-border-width) * 2 + 100%); | ||
top: calc(var(--card-border-width) * -1); | ||
right: calc(var(--card-border-width) * -1); | ||
bottom: calc(var(--card-border-width) * -1); | ||
left: calc(var(--card-border-width) * -1); | ||
z-index: -1; | ||
} | ||
|
@@ -183,3 +183,67 @@ | |
.collage .collage-card-spacing img { | ||
object-fit: contain; | ||
} | ||
|
||
.collage--collapsed-y .collage__item .card--card, | ||
.collage--collapsed-y .collage__item--collection .card--text, | ||
.collage--collapsed-y .collage-card { | ||
height: calc(100% + var(--card-border-width)); | ||
} | ||
|
||
.collage--collapsed-x .collage-card { | ||
width: calc(100% + var(--card-border-width)); | ||
} | ||
Comment on lines
+193
to
+195
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not clear to me why we won't need to apply this style to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. I think this is here to override the |
||
|
||
/* offset collage for border collapsing */ | ||
.collage--collapsed-x { | ||
padding-right: var(--card-border-width); | ||
} | ||
.collage--collapsed-y { | ||
padding-bottom: var(--card-border-width); | ||
} | ||
|
||
/* offset collage cards for border collapsing */ | ||
.collage--collapsed-x :where(.card, .collage-card) { | ||
margin-right: calc(var(--card-border-width) * -1); | ||
} | ||
.collage--collapsed-y :where(.card--card, .text--only, .collage-card) { | ||
margin-bottom: calc(var(--card-border-width) * -1); | ||
} | ||
|
||
@media screen and (min-width: 750px) { | ||
/* offset collage card shadows to prevent overlap */ | ||
.collage--collapsed-x .collage__item--left:first-child :where(.card--card, .collage-card):after, | ||
.collage--collapsed-x .collage__item--left:first-child .card--standard .card__inner:after { | ||
margin-right: var(--card-border-width); | ||
} | ||
.collage--collapsed-x .collage__item--right:last-child :where(.card--card, .collage-card):after, | ||
.collage--collapsed-x .collage__item--right:last-child .card--standard .card__inner:after { | ||
margin-left: var(--card-border-width); | ||
} | ||
.collage--collapsed-y .collage__item--left:nth-child(3) :where(.card--card, .collage-card):after { | ||
margin-top: var(--card-border-width); | ||
} | ||
.collage--collapsed-y .collage__item--right:first-child :where(.card--card, .collage-card):after { | ||
margin-bottom: var(--card-border-width); | ||
} | ||
} | ||
|
||
@media screen and (max-width: 749px) { | ||
/* offset collage card shadows to prevent overlap */ | ||
.collage--collapsed-y:not(.collage--mobile) .collage__item:not(:first-child) :where(.card--card, .collage-card):after, | ||
.collage--collapsed-y.collage--mobile .collage__item--right:nth-child(3) :where(.card--card, .collage-card):after, | ||
.collage--collapsed-y.collage--mobile .collage__item--right:nth-child(3) .card--standard .card__inner:after { | ||
margin-top: var(--card-border-width); | ||
} | ||
.collage--mobile.collage--collapsed-y .collage__item--left:first-child :where(.card--card, .collage-card):after { | ||
margin-bottom: var(--card-border-width); | ||
} | ||
.collage--mobile.collage--collapsed-x .collage__item--left:nth-child(3) :where(.card--card, .collage-card):after, | ||
.collage--mobile.collage--collapsed-x .collage__item--left:nth-child(3) .card--standard .card__inner:after { | ||
margin-left: var(--card-border-width); | ||
} | ||
.collage--mobile.collage--collapsed-x .collage__item--right:first-child :where(.card--card, .collage-card):after, | ||
.collage--mobile.collage--collapsed-x .collage__item--right:first-child .card--standard .card__inner:after { | ||
margin-right: var(--card-border-width); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,16 @@ slider-component.slider-component-full-width { | |
.slider.slider--mobile.contains-content-container .slider__slide { | ||
--focus-outline-padding: 0rem; | ||
} | ||
|
||
.slider.slider--mobile.grid--collapsed .slider__slide { | ||
--collapsed-offset-y: 0px; | ||
--collapsed-shadow-offset-y: 0px; | ||
--collapsed-shadow-offset-x: var(--border-width); | ||
} | ||
|
||
.slider.slider--mobile.grid--collapsed .slider__slide:first-child { | ||
--collapsed-shadow-offset-x: 0px; | ||
} | ||
} | ||
|
||
@media screen and (min-width: 750px) { | ||
|
@@ -103,6 +113,17 @@ slider-component.slider-component-full-width { | |
.slider.slider--tablet.contains-content-container .slider__slide { | ||
--focus-outline-padding: 0rem; | ||
} | ||
|
||
.slider.slider--tablet.grid--collapsed .slider__slide { | ||
--collapsed-offset-y: 0px; | ||
--collapsed-shadow-offset-y: 0px; | ||
--collapsed-shadow-offset-x: var(--border-width); | ||
} | ||
|
||
.slider.slider--tablet.grid--collapsed .slider__slide:first-child { | ||
--collapsed-shadow-offset-x: 0px; | ||
} | ||
Comment on lines
+118
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the slider overrides to desktop grid which should resolve this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's just that the calculation is based on the horizontal space value and when it's set to 0 then it means no extra space for the grid peek. Should be easy to fix in another PR (I can create the issue) by adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a question around css variable assignment. I would have thought that applying it to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm applying it to a Basically, the first rule is overriding the values (from This is the type of selector sliders need to override from grid-collapsed.css..
Also in the corner commit it looks like I had to add even more specificity here and that prompted me to include a comment |
||
|
||
} | ||
|
||
.slider--everywhere { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will also need to change/edit the width of the slides for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you open a ticket for this with notes on what you think needs to be done for this? I'm not familiar with the new desktop slider. It's odd that the other grid width calculations adjust just fine as is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
@@ -191,6 +212,20 @@ slider-component.slider-component-full-width { | |
.slider.slider--desktop.contains-content-container .slider__slide { | ||
--focus-outline-padding: 0rem; | ||
} | ||
|
||
.slider.slider--desktop.contains-content-container .slider__slide { | ||
--focus-outline-padding: 0rem; | ||
} | ||
/* specificity here matters */ | ||
.slider.slider--desktop.grid--collapsed .slider__slide.grid__item { | ||
--collapsed-offset-y: 0px; | ||
--collapsed-shadow-offset-y: 0px; | ||
--collapsed-shadow-offset-x: var(--border-width); | ||
} | ||
|
||
.slider.slider--desktop.grid--collapsed .slider__slide:first-child { | ||
--collapsed-shadow-offset-x: 0px; | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file will eventually be.. a lot. I figure it might be worthwhile to at least define some of the vars and things in comments, but I'm happy to remove them if they're not helpful. |
||
--collapsed-offset-x/y: the distance to offset an item's border onto the siblings below and to the right | ||
--collapsed-shadow-offset-x/y: the distance to offset the overlapping shadows caused by offsetting grid items | ||
kmeleta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
.grid--collapsed-x { | ||
--collapsed-offset-x: var(--border-width); | ||
} | ||
.grid--collapsed-y { | ||
--collapsed-offset-y: var(--border-width); | ||
} | ||
|
||
.grid--collapsed-x .grid__item { | ||
--collapsed-offset-x: calc(var(--border-width) * -1); | ||
--collapsed-shadow-offset-x: var(--border-width); | ||
} | ||
.grid--collapsed-y .grid__item { | ||
--collapsed-offset-y: calc(var(--border-width) * -1); | ||
--collapsed-shadow-offset-y: var(--border-width); | ||
} | ||
|
||
@media screen and (max-width: 989px) { | ||
/* reset shadow origin along first row/col so its flush with grid edge */ | ||
.grid--1-col-tablet-down.grid--collapsed-x .grid__item, | ||
.grid--2-col-tablet-down.grid--collapsed-x .grid__item:nth-child(2n + 1) { | ||
--collapsed-shadow-offset-x: 0px; | ||
} | ||
.grid--1-col-tablet-down.grid--collapsed-y .grid__item:first-child, | ||
.grid--2-col-tablet-down.grid--collapsed-y .grid__item:nth-child(-n + 2) { | ||
--collapsed-shadow-offset-y: 0px; | ||
} | ||
} | ||
|
||
@media screen and (min-width: 990px) { | ||
/* reset shadow origin along first row/col so its flush with grid edge */ | ||
.grid--1-col-desktop.grid--collapsed-x .grid__item, | ||
.grid--2-col-desktop.grid--collapsed-x .grid__item:nth-child(2n + 1), | ||
.grid--3-col-desktop.grid--collapsed-x .grid__item:nth-child(3n + 1), | ||
.grid--4-col-desktop.grid--collapsed-x .grid__item:nth-child(4n + 1), | ||
.grid--5-col-desktop.grid--collapsed-x .grid__item:nth-child(5n + 1), | ||
.grid--6-col-desktop.grid--collapsed-x .grid__item:nth-child(6n + 1) { | ||
--collapsed-shadow-offset-x: 0px; | ||
} | ||
.grid--1-col-desktop.grid--collapsed-y .grid__item:nth-child(1), | ||
.grid--2-col-desktop.grid--collapsed-y .grid__item:nth-child(-n + 2), | ||
.grid--3-col-desktop.grid--collapsed-y .grid__item:nth-child(-n + 3), | ||
.grid--4-col-desktop.grid--collapsed-y .grid__item:nth-child(-n + 4), | ||
.grid--5-col-desktop.grid--collapsed-y .grid__item:nth-child(-n + 5), | ||
.grid--6-col-desktop.grid--collapsed-y .grid__item:nth-child(-n + 6) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that the Featured Collection section and Collection template have a 5 column product grid setting. Is there a template or section that has a 6 column option? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to cut out one those cases out of the collapsed code, but I believe multicolumn allows 6. |
||
--collapsed-shadow-offset-y: 0px; | ||
} | ||
} |
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.
Do you need to include the
contains-xyz
here for specificity?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.
We discussed this a bit already but will respond with my thoughts here for ref. Including the contains classes here was a little bit of premature optimization to protect against future possible cases like
content-container
grid items that also have children using.global-media-settings
. We wouldn't want any collapsed grid styles to apply to the deeper children. Maybe this won't ever occur, but I'm not certain.This does unnecessarily create slightly higher specifically right now, but I see the collapsed grid as something that's hard to test at scale and likely to have regressions go unnoticed. For these reasons I like the idea of a little additional futureproof-ness. I don't necessarily think the collapsed grid styles being more difficult to override is a totally bad thing in some cases.
I think for now we can include the removal of this a follow up enhancement to consider. I'm sure there are other things that will also fit into this category.