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

<div {% render 'section-attr' %}>
  {% render 'section-bg-image' %}
  <xo-container {% render 'section-layout' %}>
    <xo-carousel
      xo-breakpoints='
        {
          500: {
            perView: 1,
          },
          700: {
            perView: 3,
          },
          1000: {
            perView: 4,
          },
          1200: {
            perView: 5,
          },
        }
      '
      {% if section.settings.autoplay %}
        xo-autoplay='3000'
      {% endif %}
      xo-per-view='{{ section.settings.columns_carousel }}'
      xo-speed='400'
      xo-loop
      xo-hover-pause
      xo-gap='0'
    >
      <xo-carousel-inner class='brand-v1__inner'>
        <xo-carousel-list>
          {% for block in section.blocks %}
            <xo-carousel-slide>
              <a class='brand-v1__item' href='{{ block.settings.brand_link }}'>
                <div class='brand-v1__image'>
                  {% if block.settings.brand_svg != empty %}
                    {{ block.settings.brand_svg }}
                  {% elsif block.settings.image != empty %}
                    {% render 'image', image: block.settings.image %}
                  {% endif %}
                </div>
              </a>
            </xo-carousel-slide>
          {% endfor %}
        </xo-carousel-list>
      </xo-carousel-inner>
    </xo-carousel>
  </xo-container>
</div>

{% schema %}
{
  "name": "t:sections.brand_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": "columns_carousel",
      "min": 3,
      "max": 10,
      "step": 1,
      "label": "t:sections.brand_v1.settings.columns_carousel.label",
      "default": 6
    },
    {
      "type": "checkbox",
      "id": "autoplay",
      "label": "t:sections.brand_v1.settings.autoplay.label",
      "default": false
    },
    {
      "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": [
    {
      "name": "Brand",
      "type": "brand-v1",
      "settings": [
        {
          "type": "image_picker",
          "id": "image",
          "label": "Brand Image"
        },
        {
          "type": "url",
          "id": "brand_link",
          "label": "URL Brand",
          "default": "/collections/all"
        },
        {
          "type": "html",
          "id": "brand_svg",
          "label": "SVG Brand"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "t:sections.brand_v1.presets.name"
    }
  ]
}
{% endschema %}
