diff --git a/assets/base.css b/assets/base.css index 04e511edfa6..e758d3be7d5 100644 --- a/assets/base.css +++ b/assets/base.css @@ -3468,3 +3468,101 @@ details-disclosure > details { --border-offset: 0px; /* Prevent the border from growing on buttons when this effect is on. */ } } + +/* Loading spinner */ +.loading__spinner { + position: absolute; + z-index: 1; + width: 1.8rem; +} + +.loading__spinner { + width: 1.8rem; + display: inline-block; +} + +.spinner { + animation: rotator 1.4s linear infinite; +} + +@keyframes rotator { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(270deg); + } +} + +.path { + stroke-dasharray: 280; + stroke-dashoffset: 0; + transform-origin: center; + stroke: rgb(var(--color-foreground)); + animation: dash 1.4s ease-in-out infinite; +} + +@media screen and (forced-colors: active) { + .path { + stroke: CanvasText; + } +} + +@keyframes dash { + 0% { + stroke-dashoffset: 280; + } + 50% { + stroke-dashoffset: 75; + transform: rotate(135deg); + } + 100% { + stroke-dashoffset: 280; + transform: rotate(450deg); + } +} + +.loading__spinner:not(.hidden) + .cart-item__price-wrapper, +.loading__spinner:not(.hidden) ~ cart-remove-button { + opacity: 50%; +} + +.loading__spinner:not(.hidden) ~ cart-remove-button { + pointer-events: none; + cursor: default; +} + +/* Progress bar */ +.progress-bar-container { + width: 100%; + margin: auto; +} + +.progress-bar { + height: 0.13rem; + width: 100%; +} + +.progress-bar-value { + width: 100%; + height: 100%; + background-color: rgb(var(--color-foreground)); + animation: indeterminateAnimation var(--duration-extra-longer) infinite ease-in-out; + transform-origin: 0; +} + +.progress-bar .progress-bar-value { + display: block; +} + +@keyframes indeterminateAnimation { + 0% { + transform: translateX(-20%) scaleX(0); + } + 40% { + transform: translateX(30%) scaleX(0.7); + } + 100% { + transform: translateX(100%) scaleX(0); + } +} diff --git a/assets/component-loading-spinner.css b/assets/component-loading-spinner.css deleted file mode 100644 index 6cc341a3ed7..00000000000 --- a/assets/component-loading-spinner.css +++ /dev/null @@ -1,61 +0,0 @@ -.loading__spinner { - position: absolute; - z-index: 1; - width: 1.8rem; -} - -.loading__spinner { - width: 1.8rem; - display: inline-block; -} - -.spinner { - animation: rotator 1.4s linear infinite; -} - -@keyframes rotator { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(270deg); - } -} - -.path { - stroke-dasharray: 280; - stroke-dashoffset: 0; - transform-origin: center; - stroke: rgb(var(--color-foreground)); - animation: dash 1.4s ease-in-out infinite; -} - -@media screen and (forced-colors: active) { - .path { - stroke: CanvasText; - } -} - -@keyframes dash { - 0% { - stroke-dashoffset: 280; - } - 50% { - stroke-dashoffset: 75; - transform: rotate(135deg); - } - 100% { - stroke-dashoffset: 280; - transform: rotate(450deg); - } -} - -.loading__spinner:not(.hidden) + .cart-item__price-wrapper, -.loading__spinner:not(.hidden) ~ cart-remove-button { - opacity: 50%; -} - -.loading__spinner:not(.hidden) ~ cart-remove-button { - pointer-events: none; - cursor: default; -} diff --git a/sections/collage.liquid b/sections/collage.liquid index fbef5b33a14..8617847ee7c 100644 --- a/sections/collage.liquid +++ b/sections/collage.liquid @@ -26,6 +26,7 @@ {%- endif -%}
+ {% assign skip_card_product_styles = false %} {%- for block in section.blocks -%}
+ {% assign skip_card_product_styles = false %} {%- for product in section.settings.collection.products limit: section.settings.products_to_show -%}
  • + {%- assign skip_card_product_styles = true -%} {%- else -%} {%- for i in (1..section.settings.columns_desktop) -%}
  • + {% assign skip_card_product_styles = false %} {%- for product in collection.products -%} {% assign lazy_load = false %} {%- if forloop.index > 2 -%} @@ -170,10 +171,12 @@ show_vendor: section.settings.show_vendor, show_rating: section.settings.show_rating, lazy_load: lazy_load, + skip_styles: skip_card_product_styles, quick_add: section.settings.quick_add, section_id: section.id %}
  • + {%- assign skip_card_product_styles = true -%} {%- endfor -%} diff --git a/sections/main-product.liquid b/sections/main-product.liquid index f591c7ad5b3..33ab1f4694f 100644 --- a/sections/main-product.liquid +++ b/sections/main-product.liquid @@ -552,6 +552,7 @@ aria-label="{{ 'general.slider.name' | t }}" {% endif %} > + {% assign skip_card_product_styles = false %} {%- for i in (1..number_of_slides) -%}
    + {%- assign skip_card_product_styles = true -%} {%- endfor -%}
    diff --git a/sections/main-search.liquid b/sections/main-search.liquid index 403be35d68c..66e7328034f 100644 --- a/sections/main-search.liquid +++ b/sections/main-search.liquid @@ -254,6 +254,7 @@ class="grid product-grid grid--{{ section.settings.columns_mobile }}-col-tablet-down grid--{{ section.settings.columns_desktop }}-col-desktop" role="list" > + {%- assign skip_card_product_styles = false -%} {%- for item in search.results -%} {% assign lazy_load = false %} {%- if forloop.index > 2 -%} @@ -276,8 +277,10 @@ show_secondary_image: section.settings.show_secondary_image, show_vendor: section.settings.show_vendor, show_rating: section.settings.show_rating, - lazy_load: lazy_load + lazy_load: lazy_load, + skip_styles: skip_card_product_styles %} + {%- assign skip_card_product_styles = true -%} {%- when 'article' -%} {% render 'article-card', article: item, diff --git a/sections/related-products.liquid b/sections/related-products.liquid index 920932e13e2..8de59a0d530 100644 --- a/sections/related-products.liquid +++ b/sections/related-products.liquid @@ -35,6 +35,7 @@ class="grid product-grid grid--{{ section.settings.columns_desktop }}-col-desktop grid--{{ section.settings.columns_mobile }}-col-tablet-down" role="list" > + {% assign skip_card_product_styles = false %} {% for recommendation in recommendations.products %}
  • {% render 'card-product', @@ -43,9 +44,11 @@ image_shape: section.settings.image_shape, show_secondary_image: section.settings.show_secondary_image, show_vendor: section.settings.show_vendor, - show_rating: section.settings.show_rating + show_rating: section.settings.show_rating, + skip_styles: skip_card_product_styles %}
  • + {%- assign skip_card_product_styles = true -%} {% endfor %} {% endif %} diff --git a/snippets/card-product.liquid b/snippets/card-product.liquid index a617e08ae07..df66b950a10 100644 --- a/snippets/card-product.liquid +++ b/snippets/card-product.liquid @@ -10,6 +10,7 @@ - show_rating: {Boolean} Show the product rating. Default: false - extend_height: {Boolean} Card height extends to available container space. Default: true (optional) - lazy_load: {Boolean} Image should be lazy loaded. Default: true (optional) + - skip_styles: {Boolean} Don't include component styles. Useful when rendering multiple product cards in a loop. Default: false (optional) - quick_add: {Boolean} Show the quick add button. - section_id: {String} The ID of the section that contains this card. - horizontal_class: {Boolean} Add a card--horizontal class if set to true. Default: false (optional) @@ -19,14 +20,14 @@ Usage: {% render 'card-product', show_vendor: section.settings.show_vendor %} {% endcomment %} +{%- unless skip_styles -%} + {{ 'component-rating.css' | asset_url | stylesheet_tag }} + {{ 'component-volume-pricing.css' | asset_url | stylesheet_tag }} -{{ 'component-rating.css' | asset_url | stylesheet_tag }} -{{ 'component-volume-pricing.css' | asset_url | stylesheet_tag }} - -{{ 'component-price.css' | asset_url | stylesheet_tag }} -{{ 'quick-order-list.css' | asset_url | stylesheet_tag }} -{{ 'quantity-popover.css' | asset_url | stylesheet_tag }} - + {{ 'component-price.css' | asset_url | stylesheet_tag }} + {{ 'quick-order-list.css' | asset_url | stylesheet_tag }} + {{ 'quantity-popover.css' | asset_url | stylesheet_tag }} +{%- endunless -%} {%- if card_product and card_product != empty -%} {%- liquid assign ratio = 1 diff --git a/snippets/loading-spinner.liquid b/snippets/loading-spinner.liquid index bd40d3d4bb6..4c2d649fbb6 100644 --- a/snippets/loading-spinner.liquid +++ b/snippets/loading-spinner.liquid @@ -7,8 +7,6 @@ {% render 'loading-spinner' %} {% endcomment %} -{{ 'component-loading-spinner.css' | asset_url | stylesheet_tag }} -