Ajustes antes de produccion

This commit is contained in:
2026-10-22 00:07:21 -06:00
parent f9666c4088
commit 1be9d16c83
124 changed files with 3540 additions and 772 deletions
+115 -4
View File
@@ -6,10 +6,11 @@
endif
if section.settings.cover_link != blank
assign cover_tag = 'a'
assign cover_href = section.settings.cover_link
else
assign cover_tag = 'div'
assign cover_href = '/collections/kits-skincare-facial'
endif
assign cover_tag = 'a'
%}
<section class="routine full-width">
@@ -17,7 +18,7 @@
<{{ cover_tag }}
class="routine__cover"
{% if cover_tag == 'a' %}
href="{{ section.settings.cover_link }}"
href="{{ cover_href }}"
{% endif %}
>
{% if section.settings.cover_image != blank %}
@@ -47,7 +48,8 @@
<h2 class="routine__heading">{{ heading | escape | newline_to_br }}</h2>
</{{ cover_tag }}>
<div class="routine__steps">
<div class="routine__steps" data-routine-viewport>
<div class="routine__track" data-routine-track>
{% for block in section.blocks %}
{% liquid
if block.settings.title != blank
@@ -140,10 +142,119 @@
<p class="routine__empty">{{ 'routine.empty' | t }}</p>
{% endif %}
{% endfor %}
</div>
</div>
<div class="routine__progress" aria-hidden="true">
<span class="routine__progress-bar" data-routine-bar></span>
</div>
</div>
</section>
<script nolazy>
(() => {
const sliderQuery = window.matchMedia('(max-width: 1024px)');
const phoneQuery = window.matchMedia('(max-width: 767px)');
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
const strideOf = (viewport) => {
const card = viewport.querySelector('.routine__card');
const track = viewport.querySelector('[data-routine-track]');
if (!card) return 0;
const gap = track ? parseFloat(window.getComputedStyle(track).columnGap) || 0 : 0;
return card.getBoundingClientRect().width + gap;
};
const updateProgress = (viewport) => {
const section = viewport.closest('.routine');
const bar = section && section.querySelector('[data-routine-bar]');
if (!bar) return;
const max = viewport.scrollWidth - viewport.clientWidth;
const visible = viewport.scrollWidth > 0 ? viewport.clientWidth / viewport.scrollWidth : 1;
const width = Math.min(Math.max(visible * 100, 12), 100);
const travel = 100 - width;
const progress = max <= 2 ? 0 : viewport.scrollLeft / max;
bar.style.width = `${width}%`;
bar.style.left = `${progress * travel}%`;
};
const goTo = (viewport, index, behavior) => {
const stride = strideOf(viewport);
const count = viewport.querySelectorAll('.routine__card').length;
if (!stride || !count) return;
const wrapped = ((index % count) + count) % count;
const max = Math.max(viewport.scrollWidth - viewport.clientWidth, 0);
viewport.scrollTo({ left: Math.min(wrapped * stride, max), behavior });
};
const boot = (section) => {
const viewport = section.querySelector('[data-routine-viewport]');
if (!viewport || viewport.dataset.ready === 'true') return;
viewport.dataset.ready = 'true';
const pause = () => {
if (viewport._routineTimer) window.clearInterval(viewport._routineTimer);
viewport._routineTimer = null;
};
const play = () => {
pause();
if (!sliderQuery.matches || reduceMotion.matches || viewport.dataset.paused === 'true') return;
viewport._routineTimer = window.setInterval(() => {
const max = viewport.scrollWidth - viewport.clientWidth;
if (max <= 2) return;
const stride = strideOf(viewport);
const count = viewport.querySelectorAll('.routine__card').length;
if (!stride || count < 2) return;
const index = Math.round(viewport.scrollLeft / stride);
const behavior = reduceMotion.matches ? 'auto' : 'smooth';
goTo(viewport, index + 1 >= count ? 0 : index + 1, behavior);
}, 4000);
};
if (phoneQuery.matches) goTo(viewport, 0, 'auto');
updateProgress(viewport);
play();
viewport.addEventListener('scroll', () => updateProgress(viewport), { passive: true });
viewport.addEventListener('pointerdown', () => {
viewport.dataset.paused = 'true';
pause();
});
viewport.addEventListener('pointerup', () => {
window.setTimeout(() => {
delete viewport.dataset.paused;
play();
}, 2500);
});
viewport.addEventListener('pointercancel', () => {
delete viewport.dataset.paused;
play();
});
const onChange = () => {
if (phoneQuery.matches) {
const stride = strideOf(viewport);
const index = stride ? Math.round(viewport.scrollLeft / stride) : 0;
goTo(viewport, index, 'auto');
}
updateProgress(viewport);
play();
};
sliderQuery.addEventListener('change', onChange);
phoneQuery.addEventListener('change', onChange);
window.addEventListener('resize', onChange);
};
document.querySelectorAll('.routine').forEach(boot);
if (window.__seasonRoutine) return;
window.__seasonRoutine = true;
document.addEventListener('shopify:section:load', (event) => {
const section = event.target.querySelector('.routine');
if (section) boot(section);
});
})();
</script>
{% schema %}
{
"name": "t:routine.name",