Files
2026-10-09 23:02:05 -06:00

232 lines
6.4 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>
{% 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 %}