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

<section class='collection-v47'>
  <div {% render 'section-attr', color_scheme: section.settings.color_scheme, background_color: section.settings.background_color %}>
    <xo-container {% render 'section-layout' %}>
      <xo-animate
        xo-type='fade-up'
        xo-delay='100'
        xo-duration='1000'
      >
        <ul class='collection-v47__block-list'>
          {%- for block in section.blocks -%}
            {%- if block.settings.collection != blank -%}
              <li class='collection-v47__block-item' style='--item-gap: {{section.settings.gap }}px'>
                <a href='{{block.settings.collection.url }}'>
                  <xo-parallax class='collection-v47__block'>
                    <div class='collection-v47__block-content'>
                      <h4 class='collection-v47__block-title'>{{ block.settings.collection.title }}</h4>
                      <span class='collection-v47__block-product'> {{ block.settings.collection.products_count }} products</span>
                    </div>
                    <xo-parallax-hover xo-strength='160' class='collection-v47__block-img'>
                      {%- if block.settings.collection_image -%}
                        {%- render 'image', image: block.settings.collection_image -%}
                      {%- else -%}
                        {%- render 'image', image: block.settings.collection.featured_image -%}
                      {%- endif -%}
                    </xo-parallax-hover>
                  </xo-parallax>
                </a>
              </li>
            {%- endif -%}
          {%- endfor -%}
        </ul>
      </xo-animate>
    </xo-container>
  </div>
</section>

{% schema %}
{
  "name": "t:sections.collection_v1.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": "gap",
      "min": 10,
      "max": 60,
      "step": 1,
      "unit": "px",
      "label": "t:sections.collection_v1.settings.gap.label",
      "default": 15
    },
    {
      "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": "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": "review",
      "name": " Collection",
      "settings": [
        {
          "type": "collection",
          "id": "collection",
          "label": "t:sections.collection_v1.blocks.settings.collection.label"
        },
        {
          "type": "image_picker",
          "id": "collection_image",
          "label": "t:sections.collection_v1.blocks.settings.collection_image.label",
          "info": "Support jpg, jpeg, png, svg"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "t:sections.collection_v1.presets.name"
    }
  ]
}
{% endschema %}
