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

<section {% render 'section-attr', color_scheme: section.settings.color_scheme %}>
  {% render 'section-bg-image' %}

  <div
    class='collection-v48-background'
  >
    <xo-container class='{{"xo-container--"| append: section.settings.width}}'>
      <xo-grid style=' --xs:1;--sm:2;--md:3;--lg:3;--xl: {{ section.settings.columns_carousel }}; --xo-grid-col-gap: {{section.settings.gap}}px; --xo-grid-row-gap : {{section.settings.gap}}px'>
        {%- for block in section.blocks -%}
          {%- if block.settings.collection != blank -%}
            <xo-image-zoom
              class='collection-v48__background-hover'
              xo-zoom='1'
              {%- if block.settings.collection_image -%}
              xo-zoom-src="{{block.settings.collection_image |image_url}}"
                {%- else -%}
              xo-zoom-src=" {{block.settings.collection.featured_image |image_url}}"
              {%- endif -%}
              xo-use-wheel='false'
            >
              <a
                href='{{block.settings.collection.url }}'
                class='collection-v48__block'
                style="
                  {%- if block.settings.collection_image -%}
                    background-image:url('{{block.settings.collection_image | image_url}}'); 
                    {%- else -%}
                    background-image:url('{{block.settings.collection.featured_image | image_url}}'); 
                  {%- endif -%}
                --hover-bgcolor:{{block.settings.hover_bg-color }}"
              >
                <div class='collection-v48__content-hover'>
                  <div>
                    <h4 class='collection-v48__title'>{{ block.settings.collection.title }}</h4>
                    <div class='collection-v48__items'>
                      <p>{{ block.settings.collection.products_count }} items</p>
                    </div>
                  </div>
                  <span class='collection-v48__view-collection'> {{ block.settings.btn_text }} </span>
                </div>
                <div class='collection-v48__content'>
                  <h4 class='collection-v48__title'>{{ block.settings.collection.title }}</h4>
                  <div class='collection-v48__items'>
                    <p>{{ block.settings.collection.products_count }} items</p>
                  </div>
                </div>
              </a>
            </xo-image-zoom>
          {%- endif -%}
        {%- endfor -%}
      </xo-grid>
    </xo-container>
  </div>
</section>

{% schema %}
{
  "name": "t:sections.collection_v3.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.collection_v3.settings.width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.collection_v3.settings.width.options__1.label"
        },
        {
          "value": "wide",
          "label": "t:sections.collection_v3.settings.width.options__2.label"
        }
      ]
    },
    {
      "type": "range",
      "id": "columns_carousel",
      "min": 2,
      "max": 6,
      "step": 1,
      "label": "t:sections.collection_v3.settings.columns_carousel.label",
      "default": 4
    },
    {
      "type": "range",
      "id": "gap",
      "min": 10,
      "max": 60,
      "step": 1,
      "unit": "px",
      "label": "t:sections.collection_v3.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": "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": "review",
      "name": "Collection",
      "settings": [
        {
          "type": "collection",
          "id": "collection",
          "label": "t:sections.collection_v3.blocks.settings.collection.label"
        },
        {
          "type": "image_picker",
          "id": "collection_image",
          "label": "t:sections.collection_v3.blocks.settings.collection_image.label",
          "info": "Support jpg, jpeg, png, svg"
        },
        {
          "type": "text",
          "id": "btn_text",
          "label": "t:sections.collection_v3.blocks.settings.btn_text.label",
          "default": "view collection"
        },
        {
          "type": "color_background",
          "id": "hover_bg-color",
          "label": "t:sections.collection_v3.blocks.settings.hover_bg-color.label",
          "default": "#ccc"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "t:sections.collection_v3.presets.name",
      "category": "Text"
    }
  ]
}
{% endschema %}
