quitar media print css
This commit is contained in:
@@ -0,0 +1,784 @@
|
||||
{% liquid
|
||||
if section.settings.heading != blank
|
||||
assign heading = section.settings.heading
|
||||
else
|
||||
assign heading = 'testimonials.heading' | t
|
||||
endif
|
||||
|
||||
if section.settings.subheading != blank
|
||||
assign subheading = section.settings.subheading
|
||||
else
|
||||
assign subheading = 'testimonials.subheading' | t
|
||||
endif
|
||||
%}
|
||||
|
||||
<section
|
||||
class="testimonials full-width"
|
||||
id="Testimonials-{{ section.id }}"
|
||||
data-testimonials
|
||||
data-cart-add-url="{{ routes.cart_add_url }}.js"
|
||||
data-checkout-url="{{ routes.root_url }}checkout"
|
||||
>
|
||||
<img
|
||||
class="testimonials__blob"
|
||||
src="{{ 'testimonials-blob.avif' | asset_url }}"
|
||||
alt=""
|
||||
width="434"
|
||||
height="486"
|
||||
>
|
||||
|
||||
<div class="testimonials__header">
|
||||
<h2 class="testimonials__heading">{{ heading | escape }}</h2>
|
||||
{% if subheading != blank %}
|
||||
<p class="testimonials__subheading">{{ subheading | escape }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if section.blocks.size > 0 %}
|
||||
<div class="testimonials__stage">
|
||||
<div class="testimonials__copy">
|
||||
{% for block in section.blocks %}
|
||||
<div
|
||||
class="testimonials__slide"
|
||||
data-slide
|
||||
{{ block.shopify_attributes }}
|
||||
{% unless forloop.first %}hidden{% endunless %}
|
||||
>
|
||||
<div class="testimonials__meta">
|
||||
<div class="testimonials__stars" aria-label="{{ 'testimonials.rating' | t: rating: block.settings.rating }}">
|
||||
{% for index in (1..5) %}
|
||||
<span class="testimonials__star{% if index > block.settings.rating %} is-off{% endif %}" aria-hidden="true">
|
||||
<svg width="15" height="15" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M7.69531 9.39111C7.62954 9.39136 7.56536 9.37086 7.51191 9.33251L5 7.51142L2.48809 9.33251C2.43442 9.37144 2.36977 9.39228 2.30347 9.39204C2.23718 9.3918 2.17268 9.37048 2.1193 9.33117C2.06592 9.29186 2.02642 9.23659 2.00652 9.17335C1.98662 9.11011 1.98735 9.04218 2.00859 8.97939L2.98828 6.07763L0.449219 4.33642C0.394221 4.29874 0.352712 4.24447 0.330756 4.18153C0.3088 4.11858 0.307549 4.05027 0.327184 3.98656C0.34682 3.92285 0.386313 3.86709 0.439895 3.82743C0.493476 3.78777 0.558336 3.76628 0.625 3.7661H3.75742L4.70273 0.856925C4.7231 0.794117 4.76283 0.739373 4.81624 0.700546C4.86964 0.66172 4.93397 0.640807 5 0.640807C5.06603 0.640807 5.13036 0.66172 5.18376 0.700546C5.23717 0.739373 5.2769 0.794117 5.29727 0.856925L6.24258 3.76708H9.375C9.44175 3.76705 9.50675 3.78839 9.56049 3.82797C9.61423 3.86756 9.65389 3.92331 9.67365 3.98707C9.69341 4.05082 9.69223 4.11923 9.6703 4.18227C9.64837 4.24531 9.60682 4.29967 9.55176 4.33739L7.01172 6.07763L7.99082 8.97861C8.00668 9.02557 8.01115 9.07564 8.00384 9.12467C7.99653 9.17371 7.97766 9.2203 7.94879 9.2606C7.91992 9.3009 7.88188 9.33375 7.8378 9.35644C7.79373 9.37913 7.74489 9.39102 7.69531 9.39111Z" fill="currentColor"/>
|
||||
</svg>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if block.settings.author != blank %}
|
||||
<p class="testimonials__author">{{ block.settings.author | escape }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if block.settings.quote != blank %}
|
||||
<p class="testimonials__quote">{{ block.settings.quote | escape }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="testimonials__nav">
|
||||
<button class="testimonials__arrow" type="button" data-prev aria-label="{{ 'testimonials.previous' | t }}">
|
||||
<span class="testimonials__arrow-icon" aria-hidden="true">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.375 9.53125L10 3.90625L15.625 9.53125M10 4.6875V16.0938" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
<button class="testimonials__arrow" type="button" data-next aria-label="{{ 'testimonials.next' | t }}">
|
||||
<span class="testimonials__arrow-icon testimonials__arrow-icon--next" aria-hidden="true">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.375 9.53125L10 3.90625L15.625 9.53125M10 4.6875V16.0938" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="testimonials__products">
|
||||
{% for block in section.blocks %}
|
||||
{% liquid
|
||||
assign slide_product = block.settings.product
|
||||
assign variant = blank
|
||||
assign card_image = blank
|
||||
assign hover_image = blank
|
||||
assign subtitle = blank
|
||||
assign show_compare = false
|
||||
if slide_product != blank
|
||||
assign variant = slide_product.selected_or_first_available_variant
|
||||
assign card_image = slide_product.featured_image
|
||||
for image in slide_product.images offset: 1 limit: 1
|
||||
assign hover_image = image
|
||||
endfor
|
||||
assign subtitle = slide_product.metafields.custom.subtitulo.value | default: slide_product.metafields.custom.subtitulo
|
||||
if subtitle == blank
|
||||
assign subtitle = slide_product.metafields.custom.subtitle.value | default: slide_product.metafields.custom.subtitle
|
||||
endif
|
||||
if subtitle == blank
|
||||
assign subtitle = slide_product.metafields.custom.presentacion.value | default: slide_product.metafields.custom.presentacion
|
||||
endif
|
||||
if subtitle == blank and variant.title != 'Default Title'
|
||||
assign subtitle = variant.title
|
||||
endif
|
||||
if variant.compare_at_price > variant.price
|
||||
assign show_compare = true
|
||||
endif
|
||||
endif
|
||||
%}
|
||||
<div class="testimonials__product" data-product {% unless forloop.first %}hidden{% endunless %}>
|
||||
{% if slide_product != blank %}
|
||||
<div class="testimonials__media">
|
||||
<a class="testimonials__media-link" href="{{ slide_product.url }}">
|
||||
{% if card_image %}
|
||||
{{
|
||||
card_image
|
||||
| image_url: width: 900
|
||||
| image_tag:
|
||||
alt: slide_product.title,
|
||||
widths: '300, 450, 700, 900',
|
||||
sizes: '(max-width: 1024px) 70px, 450px',
|
||||
class: 'testimonials__image',
|
||||
loading: 'lazy'
|
||||
}}
|
||||
{% endif %}
|
||||
{% if hover_image != blank %}
|
||||
{{
|
||||
hover_image
|
||||
| image_url: width: 900
|
||||
| image_tag:
|
||||
alt: '',
|
||||
widths: '300, 450, 700, 900',
|
||||
sizes: '(max-width: 1024px) 70px, 450px',
|
||||
class: 'testimonials__image testimonials__image--hover',
|
||||
loading: 'lazy'
|
||||
}}
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
{% if variant != blank %}
|
||||
<form class="testimonials__actions testimonials__form" action="{{ routes.cart_add_url }}" method="post">
|
||||
<input type="hidden" name="id" value="{{ variant.id }}">
|
||||
<input type="hidden" name="quantity" value="1">
|
||||
<button
|
||||
class="testimonials__bag"
|
||||
type="submit"
|
||||
{% unless variant.available %}disabled{% endunless %}
|
||||
aria-label="{{ 'testimonials.add_to_cart' | t: product: slide_product.title }}"
|
||||
>
|
||||
<img src="{{ 'testimonials-bag.svg' | asset_url }}" alt="" width="25" height="25">
|
||||
</button>
|
||||
<button
|
||||
class="testimonials__buy"
|
||||
type="submit"
|
||||
data-buy
|
||||
{% unless variant.available %}disabled{% endunless %}
|
||||
>
|
||||
{% if variant.available %}
|
||||
{{ 'testimonials.buy' | t }}
|
||||
{% else %}
|
||||
{{ 'testimonials.sold_out' | t }}
|
||||
{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="testimonials__info">
|
||||
<a class="testimonials__title" href="{{ slide_product.url }}">{{ slide_product.title | escape }}</a>
|
||||
{% if subtitle != blank %}
|
||||
<p class="testimonials__subtitle">{{ subtitle | escape }}</p>
|
||||
{% endif %}
|
||||
<p class="testimonials__prices">
|
||||
<span class="testimonials__price">{{ variant.price | money_without_trailing_zeros }}</span>
|
||||
{% if show_compare %}
|
||||
<s class="testimonials__compare">{{ variant.compare_at_price | money_without_trailing_zeros }}</s>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
{% stylesheet %}
|
||||
.testimonials {
|
||||
position: relative;
|
||||
margin-top: 100px;
|
||||
padding-bottom: 100px;
|
||||
overflow: hidden;
|
||||
color: #000;
|
||||
font-family: Archivo, sans-serif;
|
||||
}
|
||||
|
||||
.testimonials__blob {
|
||||
position: absolute;
|
||||
top: 209px;
|
||||
left: 38px;
|
||||
width: 434px;
|
||||
height: auto;
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.testimonials__header {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding-inline: 100px;
|
||||
}
|
||||
|
||||
.testimonials__heading {
|
||||
margin: 0;
|
||||
font-family: "Roc Grotesk", Archivo, sans-serif;
|
||||
font-size: 30px;
|
||||
font-weight: 500;
|
||||
line-height: normal;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.testimonials__subheading {
|
||||
margin: 10px 0 0;
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.testimonials__stage {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 549fr) minmax(220px, 450px);
|
||||
column-gap: clamp(32px, 10vw, 199px);
|
||||
align-items: start;
|
||||
width: min(1198px, calc(100% - 200px));
|
||||
margin: 100px auto 0;
|
||||
}
|
||||
|
||||
.testimonials__slide[hidden],
|
||||
.testimonials__product[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.testimonials__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.testimonials__stars {
|
||||
display: flex;
|
||||
gap: 1px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.testimonials__star {
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.testimonials__star svg {
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.testimonials__star.is-off {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
.testimonials__author {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.testimonials__quote {
|
||||
max-width: 549px;
|
||||
margin: 60px 0 0;
|
||||
font-size: 35px;
|
||||
font-weight: 300;
|
||||
line-height: 45px;
|
||||
}
|
||||
|
||||
.testimonials__nav {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
margin-top: 155px;
|
||||
}
|
||||
|
||||
.testimonials__arrow {
|
||||
display: grid;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
place-items: center;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 60px;
|
||||
background: #9dd6c7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.testimonials__arrow:disabled {
|
||||
cursor: default;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.testimonials__arrow-icon {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.testimonials__arrow-icon--next {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.testimonials__product {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.testimonials__media {
|
||||
position: relative;
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
border: 1px solid #eaeaea;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.testimonials__media-link {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.testimonials__image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.testimonials__image--hover {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
transition: opacity 0.35s ease;
|
||||
}
|
||||
|
||||
.testimonials__media:hover .testimonials__image--hover,
|
||||
.testimonials__media:focus-within .testimonials__image--hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.testimonials__actions {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
bottom: 10px;
|
||||
left: 20px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.testimonials__media:hover .testimonials__actions,
|
||||
.testimonials__media:focus-within .testimonials__actions {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.testimonials__bag,
|
||||
.testimonials__buy {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 50px;
|
||||
padding: 15px;
|
||||
border: 0;
|
||||
border-radius: 60px;
|
||||
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.testimonials__bag {
|
||||
flex: 0 0 50px;
|
||||
width: 50px;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.testimonials__bag img {
|
||||
display: block;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.testimonials__buy {
|
||||
flex: 1 1 auto;
|
||||
background: #9dd6c7;
|
||||
color: #000;
|
||||
font-family: Archivo, sans-serif;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.testimonials__bag:disabled,
|
||||
.testimonials__buy:disabled {
|
||||
cursor: default;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.testimonials__title {
|
||||
display: block;
|
||||
color: #000;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
line-height: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.testimonials__subtitle {
|
||||
margin: 5px 0 0;
|
||||
color: #808181;
|
||||
font-size: 14px;
|
||||
font-weight: 300;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.testimonials__prices {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 15px 0 0;
|
||||
}
|
||||
|
||||
.testimonials__price,
|
||||
.testimonials__compare {
|
||||
width: 70px;
|
||||
font-size: 16px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.testimonials__price {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.testimonials__compare {
|
||||
color: #808181;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.testimonials__arrow:focus-visible,
|
||||
.testimonials__bag:focus-visible,
|
||||
.testimonials__buy:focus-visible,
|
||||
.testimonials__title:focus-visible,
|
||||
.testimonials__media-link:focus-visible {
|
||||
outline: 2px solid #000;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
@media (max-width: 1439px) {
|
||||
.testimonials__header {
|
||||
padding-inline: 40px;
|
||||
}
|
||||
|
||||
.testimonials__stage {
|
||||
width: min(1198px, calc(100% - 80px));
|
||||
}
|
||||
|
||||
.testimonials__blob {
|
||||
left: -40px;
|
||||
width: 280px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.testimonials {
|
||||
margin-top: 50px;
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.testimonials__blob {
|
||||
top: 80px;
|
||||
left: -30px;
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.testimonials__header {
|
||||
padding-inline: 15px;
|
||||
}
|
||||
|
||||
.testimonials__heading {
|
||||
max-width: 320px;
|
||||
font-size: 22px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.testimonials__subheading {
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.testimonials__stage {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min(372px, calc(100% - 30px));
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.testimonials__copy {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.testimonials__slide {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.testimonials__products {
|
||||
order: 2;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.testimonials__nav {
|
||||
order: 3;
|
||||
justify-content: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.testimonials__star,
|
||||
.testimonials__star svg {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.testimonials__author {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.testimonials__quote {
|
||||
margin-top: 30px;
|
||||
font-size: 18px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.testimonials__product {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: min(297px, 100%);
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.testimonials__media {
|
||||
flex: 0 0 70px;
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
aspect-ratio: auto;
|
||||
}
|
||||
|
||||
.testimonials__actions {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.testimonials__title {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.testimonials__subtitle {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.testimonials__prices {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.testimonials__price,
|
||||
.testimonials__compare {
|
||||
width: auto;
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.testimonials__image--hover,
|
||||
.testimonials__actions {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
{% endstylesheet %}
|
||||
|
||||
{% javascript %}
|
||||
(() => {
|
||||
const setCartCount = (count) => {
|
||||
const link = document.querySelector('.header__cart');
|
||||
if (!link || count < 1) return;
|
||||
|
||||
let badge = link.querySelector('[data-cart-count]');
|
||||
if (!badge) {
|
||||
badge = document.createElement('span');
|
||||
badge.className = 'absolute right-0 top-0 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand-mint px-[3px] text-[10px] font-medium leading-none text-black';
|
||||
badge.setAttribute('data-cart-count', '');
|
||||
link.appendChild(badge);
|
||||
}
|
||||
|
||||
badge.textContent = String(count);
|
||||
};
|
||||
|
||||
const boot = (root) => {
|
||||
if (root.dataset.ready === 'true') return;
|
||||
root.dataset.ready = 'true';
|
||||
|
||||
const slides = [...root.querySelectorAll('[data-slide]')];
|
||||
const products = [...root.querySelectorAll('[data-product]')];
|
||||
const prev = root.querySelector('[data-prev]');
|
||||
const next = root.querySelector('[data-next]');
|
||||
let index = 0;
|
||||
|
||||
const paint = () => {
|
||||
slides.forEach((slide, slideIndex) => {
|
||||
slide.hidden = slideIndex !== index;
|
||||
});
|
||||
products.forEach((product, productIndex) => {
|
||||
product.hidden = productIndex !== index;
|
||||
});
|
||||
if (prev) prev.disabled = index <= 0;
|
||||
if (next) next.disabled = index >= slides.length - 1;
|
||||
};
|
||||
|
||||
if (prev) {
|
||||
prev.addEventListener('click', () => {
|
||||
if (index <= 0) return;
|
||||
index -= 1;
|
||||
paint();
|
||||
});
|
||||
}
|
||||
|
||||
if (next) {
|
||||
next.addEventListener('click', () => {
|
||||
if (index >= slides.length - 1) return;
|
||||
index += 1;
|
||||
paint();
|
||||
});
|
||||
}
|
||||
|
||||
paint();
|
||||
};
|
||||
|
||||
const bootAll = (scope) => {
|
||||
scope.querySelectorAll('[data-testimonials]').forEach(boot);
|
||||
};
|
||||
|
||||
bootAll(document);
|
||||
document.addEventListener('shopify:section:load', (event) => {
|
||||
bootAll(event.target);
|
||||
});
|
||||
|
||||
if (!window.__seasonTestimonials) {
|
||||
window.__seasonTestimonials = true;
|
||||
document.addEventListener('submit', async (event) => {
|
||||
const form = event.target;
|
||||
if (!(form instanceof HTMLFormElement) || !form.classList.contains('testimonials__form')) return;
|
||||
const root = form.closest('[data-testimonials]');
|
||||
if (!root) return;
|
||||
event.preventDefault();
|
||||
|
||||
const button = event.submitter;
|
||||
if (button) button.disabled = true;
|
||||
|
||||
try {
|
||||
const response = await fetch(root.dataset.cartAddUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
||||
body: JSON.stringify({
|
||||
id: form.querySelector('[name="id"]').value,
|
||||
quantity: 1,
|
||||
}),
|
||||
});
|
||||
const data = await response.json();
|
||||
if (response.ok) {
|
||||
if (button && button.hasAttribute('data-buy') && root.dataset.checkoutUrl) {
|
||||
window.location.href = root.dataset.checkoutUrl;
|
||||
return;
|
||||
}
|
||||
const cart = await fetch('/cart.js').then((result) => result.json());
|
||||
setCartCount(cart.item_count);
|
||||
} else if (data.description) {
|
||||
window.alert(data.description);
|
||||
}
|
||||
} catch (error) {
|
||||
window.alert(error.message);
|
||||
} finally {
|
||||
if (button) button.disabled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
{% endjavascript %}
|
||||
|
||||
{% schema %}
|
||||
{
|
||||
"name": "t:testimonials.name",
|
||||
"tag": "section",
|
||||
"class": "testimonials-section",
|
||||
"disabled_on": {
|
||||
"groups": ["header", "footer"]
|
||||
},
|
||||
"settings": [
|
||||
{
|
||||
"type": "text",
|
||||
"id": "heading",
|
||||
"label": "t:testimonials.heading",
|
||||
"default": "Confianza que se construye con cada rutina"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"id": "subheading",
|
||||
"label": "t:testimonials.subheading",
|
||||
"default": "+1,500 pieles ya encontraron su rutina Seasons"
|
||||
}
|
||||
],
|
||||
"blocks": [
|
||||
{
|
||||
"type": "review",
|
||||
"name": "t:testimonials.review",
|
||||
"settings": [
|
||||
{
|
||||
"type": "textarea",
|
||||
"id": "quote",
|
||||
"label": "t:testimonials.quote",
|
||||
"default": "Tengo piel sensible y atópica y es el único bloqueador que me cae bien, la sensación es increíble y he notado que se disminuyen súper rápido las marcas post acné, lo amo, la verdad 😌💕"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"id": "author",
|
||||
"label": "t:testimonials.author",
|
||||
"default": "María José"
|
||||
},
|
||||
{
|
||||
"type": "range",
|
||||
"id": "rating",
|
||||
"label": "t:testimonials.rating_label",
|
||||
"min": 1,
|
||||
"max": 5,
|
||||
"step": 1,
|
||||
"default": 5
|
||||
},
|
||||
{
|
||||
"type": "product",
|
||||
"id": "product",
|
||||
"label": "t:testimonials.product"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"presets": [
|
||||
{
|
||||
"name": "t:testimonials.name",
|
||||
"blocks": [
|
||||
{ "type": "review" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
{% endschema %}
|
||||
Reference in New Issue
Block a user