Files
season/sections/routine.liquid
T
2026-10-02 19:32:54 -06:00

458 lines
11 KiB
Plaintext

{% liquid
if section.settings.heading != blank
assign heading = section.settings.heading
else
assign heading = 'routine.heading' | t
endif
if section.settings.cover_link != blank
assign cover_tag = 'a'
else
assign cover_tag = 'div'
endif
%}
<section class="routine full-width">
<div class="routine__layout">
<{{ cover_tag }}
class="routine__cover"
{% if cover_tag == 'a' %}
href="{{ section.settings.cover_link }}"
{% endif %}
>
{% if section.settings.cover_image != blank %}
{{
section.settings.cover_image
| image_url: width: 1700
| image_tag:
alt: heading,
widths: '400, 800, 1200, 1700',
sizes: '(max-width: 1024px) calc(100vw - 30px), 50vw',
class: 'routine__cover-image',
loading: 'lazy'
}}
{% else %}
<img
class="routine__cover-image"
src="{{ 'routine-photo.avif' | asset_url }}"
alt="{{ heading | escape }}"
width="849"
height="892"
srcset="{{ 'routine-photo-sm.avif' | asset_url }} 700w, {{ 'routine-photo.avif' | asset_url }} 1240w"
sizes="(max-width: 1024px) 95vw, 849px"
loading="lazy"
decoding="async"
>
{% endif %}
<h2 class="routine__heading">{{ heading | escape | newline_to_br }}</h2>
</{{ cover_tag }}>
<div class="routine__steps">
{% for block in section.blocks %}
{% liquid
if block.settings.title != blank
assign step_title = block.settings.title
else
assign step_key = 'routine.steps.step_' | append: forloop.index
assign step_title = step_key | t
endif
assign step_url = block.settings.link
if step_url == blank
case forloop.index
when 1
assign step_url = '/collections/1-limpia'
when 2
assign step_url = '/collections/2-trata'
when 3
assign step_url = '/collections/3-hidrata'
when 4
assign step_url = '/collections/4-protege-bloqueadores-solares'
endcase
endif
if step_url != blank
assign step_tag = 'a'
else
assign step_tag = 'div'
endif
assign fallback_image = blank
case forloop.index
when 1
assign fallback_image = 'routine-limpia.avif'
when 2
assign fallback_image = 'routine-trata.avif'
when 3
assign fallback_image = 'routine-hidrata.avif'
when 4
assign fallback_image = 'routine-protege.avif'
endcase
%}
<{{ step_tag }}
class="routine__card"
{{ block.shopify_attributes }}
{% if step_tag == 'a' %}
href="{{ step_url }}"
{% endif %}
>
<span class="routine__media">
{% if block.settings.image != blank %}
{{
block.settings.image
| image_url: width: 900
| image_tag:
alt: step_title,
widths: '245, 415, 830',
sizes: '(max-width: 1024px) 245px, 25vw',
class: 'routine__image',
loading: 'lazy'
}}
{% elsif fallback_image != blank %}
<img
class="routine__image"
src="{{ fallback_image | asset_url }}"
alt="{{ step_title | escape }}"
width="415"
height="436"
srcset="{{ fallback_image | replace: '.avif', '-sm.avif' | asset_url }} 450w, {{ fallback_image | asset_url }} 750w"
sizes="(max-width: 1024px) 245px, 415px"
loading="lazy"
decoding="async"
>
{% endif %}
<span class="routine__shade" aria-hidden="true"></span>
</span>
<span class="routine__caption">
<span class="routine__label">{{ step_title | escape }}</span>
<span class="routine__arrow" aria-hidden="true">
<span class="routine__arrow-icon">
<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>
</span>
</span>
</{{ step_tag }}>
{% else %}
{% if request.design_mode %}
<p class="routine__empty">{{ 'routine.empty' | t }}</p>
{% endif %}
{% endfor %}
</div>
</div>
</section>
{% stylesheet %}
.routine {
padding: 50px 0;
color: #000;
background: #fff;
font-family: Archivo, sans-serif;
}
.routine__layout {
display: grid;
grid-template-columns: minmax(0, 849fr) minmax(0, 850fr);
gap: 21px;
align-items: stretch;
padding-inline: 100px;
}
.routine__cover {
position: relative;
display: block;
min-height: 0;
height: 100%;
overflow: hidden;
border-radius: 10px;
color: inherit;
text-decoration: none;
}
.routine__cover-image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.routine__heading {
position: absolute;
top: 40px;
left: 40px;
margin: 0;
color: #000;
font-family: "Roc Grotesk", Archivo, sans-serif;
font-size: 50px;
font-weight: 400;
line-height: 0.98;
}
.routine__steps {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 20px;
min-width: 0;
}
.routine__card {
position: relative;
display: block;
min-width: 0;
color: inherit;
text-decoration: none;
container-type: inline-size;
}
.routine__media {
position: relative;
display: block;
aspect-ratio: 415 / 436;
overflow: hidden;
border-radius: 10px;
background: #f4f4f4;
}
.routine__image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.45s ease;
}
.routine__card:hover .routine__image,
.routine__card:focus-visible .routine__image {
transform: scale(1.06);
}
.routine__shade {
position: absolute;
inset: 0;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2));
pointer-events: none;
transition: background 0.35s ease;
}
.routine__card:hover .routine__shade,
.routine__card:focus-visible .routine__shade {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.38));
}
@media (prefers-reduced-motion: reduce) {
.routine__image,
.routine__shade {
transition: none;
}
.routine__card:hover .routine__image,
.routine__card:focus-visible .routine__image {
transform: none;
}
}
.routine__caption {
position: absolute;
right: 20px;
bottom: 10px;
left: 20px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
color: #fff;
font-family: "Roc Grotesk", Archivo, sans-serif;
font-size: clamp(16px, 7.2cqi, 30px);
font-weight: 400;
line-height: normal;
}
.routine__label {
min-width: 0;
white-space: nowrap;
}
.routine__arrow {
display: grid;
flex: 0 0 30px;
width: 30px;
height: 30px;
place-items: center;
border-radius: 60px;
background: #9dd6c7;
}
.routine__arrow-icon {
display: block;
transform: rotate(90deg);
}
.routine__empty {
grid-column: 1 / -1;
margin: 0;
font-size: 14px;
}
.routine__cover:focus-visible,
.routine__card:focus-visible {
outline: 2px solid #000;
outline-offset: 2px;
}
@media (max-width: 1439px) {
.routine__layout {
padding-inline: 40px;
}
}
@media (max-width: 1024px) {
.routine {
padding-top: 40px;
padding-bottom: 20px;
}
.routine__layout {
display: block;
padding-inline: 0;
}
.routine__cover {
height: 391px;
margin-inline: 15px;
}
.routine__heading {
top: 10px;
left: 20px;
width: 155px;
font-size: 25px;
line-height: 1;
}
.routine__steps {
display: flex;
gap: 20px;
margin-top: 0;
padding: 20px 15px;
overflow-x: auto;
scroll-snap-type: x mandatory;
scroll-padding-inline: 15px;
scrollbar-width: none;
}
.routine__steps::-webkit-scrollbar {
display: none;
}
.routine__card {
flex: 0 0 245px;
width: 245px;
scroll-snap-align: start;
}
.routine__media {
height: 258px;
aspect-ratio: auto;
}
.routine__caption {
position: static;
margin-top: 10px;
color: #000;
font-size: 22px;
}
.routine__arrow {
display: none;
}
}
{% endstylesheet %}
{% schema %}
{
"name": "t:routine.name",
"tag": "section",
"class": "routine-section",
"disabled_on": {
"groups": ["header", "footer"]
},
"settings": [
{
"type": "textarea",
"id": "heading",
"label": "t:routine.heading",
"default": "Tu rutina\nen 4 pasos"
},
{
"type": "image_picker",
"id": "cover_image",
"label": "t:routine.cover_image",
"info": "t:routine.cover_image_info"
},
{
"type": "url",
"id": "cover_link",
"label": "t:routine.cover_link"
}
],
"blocks": [
{
"type": "step",
"name": "t:routine.step",
"limit": 4,
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "t:routine.step_image",
"info": "t:routine.step_image_info"
},
{
"type": "text",
"id": "title",
"label": "t:routine.step_title"
},
{
"type": "url",
"id": "link",
"label": "t:routine.step_link"
}
]
}
],
"presets": [
{
"name": "t:routine.name",
"blocks": [
{
"type": "step",
"settings": {
"title": "Paso 1: Limpia"
}
},
{
"type": "step",
"settings": {
"title": "Paso 2: Trata"
}
},
{
"type": "step",
"settings": {
"title": "Paso 3: Hidrata"
}
},
{
"type": "step",
"settings": {
"title": "Paso 4: Protege"
}
}
]
}
]
}
{% endschema %}