{{ 'section-collection-v2.css' | asset_url | stylesheet_tag }}

<section {% render 'section-attr' %}>
  {% render 'section-bg-image' %}
  <xo-container {% render 'section-layout' %}>
    <xo-grid style='--xo-grid-col-gap: {{ section.settings.gap }}px; --xo-grid-row-gap: {{ section.settings.gap }}px;'>
      <xo-animate xo-cascade style='--xs: 12; --md: 4' class='collection-v17__banner {% render 'hover-style' %}'>
        <a href='{{ section.settings.button_link }}'>
          {% render 'image', image: section.settings.banner_image %}
        </a>
        <div class='collection-v17__banner-text'>
          <div class='collection-v17__subtitle'>{{ section.settings.banner_subtitle }}</div>
          <h3 class='collection-v17__title'>{{ section.settings.banner_title }}</h3>
          <div class='collection-v17__description'>{{ section.settings.banner_description }}</div>
          {% render 'button',
            text: section.settings.button_text,
            link: section.settings.button_link,
            mode: section.settings.button_mode,
            style: section.settings.button_style,
            size: section.settings.button_size,
            radius: section.settings.button_radius,
            padding: section.settings.button_padding
          %}
        </div>
      </xo-animate>
      <div style='--xs: 12; --md: 8'>
        <xo-grid
          style='--xs: 1; --md: 2; --xl: {{ section.settings.columns_limit }};--xo-grid-col-gap: {{ section.settings.gap }}px; --xo-grid-row-gap: {{ section.settings.gap }}px;'
          class='collection-v17__grid'
        >
          {% for block in section.blocks %}
            {% if block.settings.image != blank %}
              {% assign image = block.settings.image %}
            {% else %}
              {% assign image = block.settings.collection.featured_image %}
            {% endif %}
            <xo-animate xo-cascade class='collection-v17__item'>
              <a href='{{ block.settings.collection.url }}' class='{% render 'hover-style' %}'>
                {% render 'image', image: image, media_aspect_ratio: section.settings.aspect_ratio %}
              </a>
              <h3 class='collection-v17__item-title'>
                {{ block.settings.collection.title }}
              </h3>
            </xo-animate>
          {% endfor %}
        </xo-grid>
      </div>
    </xo-grid>
  </xo-container>
</section>

{% schema %}
{
  "name": "t:sections.collection_v2.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.all.width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.all.width.options__1.label"
        },
        {
          "value": "wide",
          "label": "t:sections.all.width.options__2.label"
        },
        {
          "value": "fullwidth",
          "label": "t:sections.all.width.options__3.label"
        }
      ]
    },
    {
      "type": "range",
      "id": "columns_limit",
      "min": 2,
      "max": 6,
      "step": 1,
      "label": "t:sections.collection_v2.settings.columns_limit.label",
      "default": 4
    },
    {
      "type": "range",
      "id": "gap",
      "min": 10,
      "max": 40,
      "step": 1,
      "unit": "px",
      "label": "t:sections.collection_v2.settings.gap.label",
      "default": 15
    },
    {
      "type": "select",
      "id": "hover",
      "label": "t:sections.all.hover.label",
      "default": "scale_up",
      "options": [
        {
          "value": "scale_up",
          "label": "t:sections.all.hover.option__1.label"
        },
        {
          "value": "scale_down",
          "label": "t:sections.all.hover.option__2.label"
        },
        {
          "value": "rotate",
          "label": "t:sections.all.hover.option__3.label"
        },
        {
          "value": "slide_up",
          "label": "t:sections.all.hover.option__4.label"
        },
        {
          "value": "ripple",
          "label": "t:sections.all.hover.option__5.label"
        },
        {
          "value": "black_white",
          "label": "t:sections.all.hover.option__6.label"
        },
        {
          "value": "shake",
          "label": "t:sections.all.hover.option__7.label"
        }
      ]
    },
    {
      "type": "text",
      "id": "aspect_ratio",
      "label": "t:sections.collection_v2.settings.aspect_ratio.label",
      "default": "1/1"
    },
    {
      "type": "header",
      "content": "t:sections.collection_v2.settings.banner_heading.content"
    },
    {
      "type": "image_picker",
      "id": "banner_image",
      "label": "t:sections.collection_v2.settings.banner_image.label"
    },
    {
      "type": "text",
      "id": "banner_subtitle",
      "label": "t:sections.collection_v2.settings.banner_subtitle.label",
      "default": "Fresh Organic"
    },
    {
      "type": "text",
      "id": "banner_title",
      "label": "t:sections.collection_v2.settings.banner_title.label",
      "default": "Fresh Food"
    },
    {
      "type": "text",
      "id": "banner_description",
      "label": "t:sections.collection_v2.settings.banner_description.label",
      "info": "t:sections.collection_v2.settings.banner_description.info",
      "default": "Sale up to <span>30% off</span>"
    },
    {
      "type": "text",
      "id": "button_text",
      "label": "t:sections.all.button_text.label",
      "default": "ALL PRODUCTS"
    },
    {
      "type": "url",
      "id": "button_link",
      "label": "t:sections.all.button_link.label",
      "default": "/collections/all"
    },
    {
      "type": "select",
      "id": "button_mode",
      "label": "t:sections.all.button_mode.label",
      "options": [
        {
          "value": "light",
          "label": "t:sections.all.button_mode.option__1.label"
        },
        {
          "value": "dark",
          "label": "t:sections.all.button_mode.option__2.label"
        },
        {
          "value": "accent",
          "label": "t:sections.all.button_mode.option__3.label"
        }
      ],
      "default": "light"
    },
    {
      "type": "select",
      "id": "button_style",
      "label": "t:sections.all.button_style.label",
      "options": [
        {
          "value": "primary",
          "label": "t:sections.all.button_style.option__1.label"
        },
        {
          "value": "secondary",
          "label": "t:sections.all.button_style.option__2.label"
        },
        {
          "value": "tertiary",
          "label": "t:sections.all.button_style.option__3.label"
        },
        {
          "value": "link",
          "label": "t:sections.all.button_style.option__4.label"
        }
      ],
      "default": "secondary"
    },
    {
      "type": "select",
      "id": "button_size",
      "label": "t:sections.all.button_size.label",
      "options": [
        {
          "value": "xs",
          "label": "t:sections.all.button_size.option__0.label"
        },
        {
          "value": "sm",
          "label": "t:sections.all.button_size.option__1.label"
        },
        {
          "value": "md",
          "label": "t:sections.all.button_size.option__2.label"
        },
        {
          "value": "lg",
          "label": "t:sections.all.button_size.option__3.label"
        }
      ],
      "default": "sm"
    },
    {
      "type": "range",
      "id": "button_radius",
      "label": "t:sections.all.button_radius.label",
      "max": 4,
      "min": 0,
      "step": 0.2,
      "unit": "rem",
      "default": 0.8
    },
    {
      "type": "range",
      "id": "button_padding",
      "label": "t:sections.all.button_padding.label",
      "info": "t:sections.all.button_padding.info",
      "max": 10,
      "min": 0,
      "step": 0.2,
      "unit": "rem",
      "default": 1.4
    },
    {
      "type": "header",
      "content": "t:sections.all.heading.content"
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.color_scheme.label"
    },
    {
      "type": "color",
      "id": "background_color",
      "label": "t:sections.all.bg_color.label"
    },
    {
      "type": "color_background",
      "id": "background_gradient",
      "label": "t:sections.all.bg_gradient.label"
    },
    {
      "type": "image_picker",
      "id": "background_image_desktop",
      "label": "t:sections.all.background_image_desktop.label"
    },
    {
      "type": "image_picker",
      "id": "background_image_mobile",
      "label": "t:sections.all.background_image_mobile.label"
    },
    {
      "type": "checkbox",
      "id": "use_parallax",
      "label": "t:sections.all.use_parallax.label",
      "default": true
    },
    {
      "type": "number",
      "id": "padding_top",
      "label": "t:sections.all.padding_top.label",
      "default": 50
    },
    {
      "type": "number",
      "id": "padding_bottom",
      "label": "t:sections.all.padding_bottom.label",
      "default": 50
    }
  ],
  "blocks": [
    {
      "type": "collection",
      "name": "t:sections.collection_v2.blocks.name",
      "settings": [
        {
          "type": "image_picker",
          "id": "image",
          "label": "t:sections.collection_v2.blocks.settings.image.label"
        },
        {
          "type": "collection",
          "id": "collection",
          "label": "t:sections.collection_v2.blocks.settings.collection.label"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "t:sections.collection_v2.presets.name"
    }
  ]
}
{% endschema %}
