{% 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 %}
<{{ 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 %} {{ heading | escape }} {% endif %}

{{ heading | escape | newline_to_br }}

{% 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 %} > {% 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 %} {{ step_title | escape }} {% endif %} {{ step_title | escape }} {% else %} {% if request.design_mode %}

{{ 'routine.empty' | t }}

{% endif %} {% endfor %}
{% 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 %}