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

Add bottom padding to cart subtotal section #2779

Merged
merged 7 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions assets/component-cart.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ cart-items {
pointer-events: none;
}

.cart__footer {
padding: 4rem 0 0;
}

.cart__footer-wrapper:last-child .cart__footer {
padding-bottom: 5rem;
}
Expand All @@ -78,7 +74,7 @@ cart-items {
}

.cart__footer > * + * {
margin-top: 4rem;
margin-top: 6.5rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

This may be ok, but I'm not sure if apps can inject elements into the cart footer and will inherit this additional margin too. So it may be safer to only target elements that directly follow the cart note in the DOM:

@media screen and (max-width: 749px) {
  .cart__note + * {
    margin-top: 6.5rem;
  }
}

}

.cart__footer .discounts {
Expand All @@ -87,8 +83,11 @@ cart-items {

.cart__note {
height: fit-content;
top: 2.5rem;
}



.cart__note label {
display: flex;
align-items: flex-end;
Expand Down Expand Up @@ -171,14 +170,14 @@ cart-items {
margin: 0 auto;
}

.cart__blocks > * + * {
margin-top: 1rem;
}

.cart__dynamic-checkout-buttons div[role='button'] {
border-radius: var(--buttons-radius-outset) !important;
}

.cart__blocks > * + * {
margin-top: 1rem;
}

.cart-note__label {
display: inline-block;
margin-bottom: 1rem;
Expand Down
38 changes: 37 additions & 1 deletion sections/main-cart-footer.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@
{{ 'component-price.css' | asset_url | stylesheet_tag }}
{{ 'component-discounts.css' | asset_url | stylesheet_tag }}

{%- style -%}
.section-{{ section.id }}-padding {
padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
}

@media screen and (min-width: 750px) {
.section-{{ section.id }}-padding {
padding-top: {{ section.settings.padding_top }}px;
padding-bottom: {{ section.settings.padding_bottom }}px;
}
}
{%- endstyle -%}

<div class="page-width{% if cart == empty %} is-empty{% endif %}" id="main-cart-footer" data-id="{{ section.id }}">
<div>
<div class="cart__footer">
<div class="cart__footer section-{{ section.id }}-padding">
{%- if settings.show_cart_note -%}
<cart-note class="cart__note field">
<label for="Cart-note">{{ 'sections.cart.note' | t }}</label>
Expand Down Expand Up @@ -118,6 +132,28 @@
{
"name": "t:sections.main-cart-footer.name",
"class": "cart__footer-wrapper",
"settings": [
{
"type": "range",
"id": "padding_top",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_top",
"default": 40
},
{
"type": "range",
"id": "padding_bottom",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_bottom",
"default": 40
}
],
"blocks": [
{
"type": "subtotal",
Expand Down