Skip to content
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

Fix featured collection slider margins #409

Merged
merged 1 commit into from
Aug 17, 2021
Merged

Conversation

kmeleta
Copy link
Contributor

@kmeleta kmeleta commented Aug 16, 2021

Why are these changes introduced?

Fixes #379

What approach did you take?

The product grid changes introduced in #176 applied some negative vertical margins that don't play nice with the absolutely positioned slider buttons below the slides/grid items, specifically in the featured collection section which is using the product grid (other slider sections don't appear to be affected).

The simplest fix seems to be declaring a default margin-bottom (of zero) on the slider class which will take priority over the default product grid margins. Slider slides (grid items) already set their own padding/margins in this way.

Other considerations

Another option is to just not apply the product-grid class at specific breakpoints when the slider setting is enabled, but we'd probably have to extend the product grid component to offer breakpoint exclusive classes (such as product-grid--desktop). I'm not sure this is necessary, but it's an option.

Demo links

Checklist

@kmeleta kmeleta changed the title Override product grid negative margin on sliders Fix featured collection slider margins Aug 16, 2021
@@ -17,7 +17,7 @@
endif
-%}
<div class="collection page-width{% if section.settings.swipe_on_mobile == true and section.settings.collection.all_products_count > 2 and section.settings.products_to_show > 2 %} page-width-desktop{% endif %}">
<div class="{% if section.settings.show_view_all and section.settings.swipe_on_mobile %}title-wrapper-with-link{% endif %}{% if section.settings.title == blank %} title-wrapper-with-link--no-heading{% endif %}{% if section.settings.collection.all_products_count > 2 and section.settings.swipe_on_mobile and section.settings.products_to_show > 2 %} title-wrapper--self-padded-tablet-down{% endif %}">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the product-grid issue, but fixes inconsistent spacing below the title in this section.

@kmeleta kmeleta marked this pull request as ready for review August 16, 2021 19:16
@kmeleta kmeleta requested a review from tauthomas01 August 16, 2021 19:17
@kmeleta
Copy link
Contributor Author

kmeleta commented Aug 16, 2021

@tauthomas01 you should take a look at this with your product-grid context. Interested if you see a better way to resolve this.

@ludoboludo ludoboludo self-requested a review August 17, 2021 13:27
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what negative-margin-small was solving 🤔

Tho what you did here seem to fix the problem mentioned in the issue 👌

Copy link
Contributor

@tauthomas01 tauthomas01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well 👍 clean solution

@kmeleta kmeleta merged commit eb42eca into main Aug 17, 2021
@kmeleta kmeleta deleted the product-grid-slider-fix branch August 17, 2021 15:25
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slider Arrow Icons are misaligned at specific viewports
3 participants