{{ 'section-product-v4.css' | asset_url | stylesheet_tag }}

<section {% render 'section-attr' %}>
  {% render 'section-bg-image' %}
  <xo-container {% render 'section-layout' %}>
    <xo-grid style='--xs: 1; --lg: 3; --xo-grid-col-gap: {{ section.settings.gap }}px; --xo-grid-row-gap: {{ section.settings.gap }}px; --color_text:{{ section.settings.color_text }}'>
      <div class='product-v1__box'>
        <div>
          <h2 class='product-v4__collection-title product-v4__item1'>
            {{ section.settings.collection1_title }}
          </h2>
        </div>
        <xo-carousel
          xo-vertical
          xo-per-view='{{ section.settings.rows_limit }}'
          xo-gap='10'
          xo-speed='400'
          {% if section.settings.auto_play %}
            xo-autoplay='5000'
          {% endif %}
        >
          <xo-carousel-inner class='product-v4__carousel-inner' style='--aspect-ratio: {{ section.settings.aspect_ratio }}'>
            <xo-carousel-list>
              {% for product in section.settings.collection1.products limit: section.settings.products_limit %}
                <xo-carousel-slide class='product-v4__item-wrap'>
                  <div class='product-v4__item product-v4__item1'>
                    <a href='{{ product.url }}' class='{% render 'hover-style' %} product-v4__product-image'>
                      {% render 'image', image: product.featured_image, media_aspect_ratio: section.settings.aspect_ratio %}
                    </a>
                    <div>
                      <a href='{{ product.url }}'>
                        <h3 class='product-v4__product-title'>{{ product.title }}</h3>
                      </a>
                      <div class='product-v4__price'>
                        <span>{{ product.price | money }}</span>
                        <del>{{ product.compare_at_price | money }}</del>
                      </div>
                    </div>
                  </div>
                </xo-carousel-slide>
              {% endfor %}
            </xo-carousel-list>
          </xo-carousel-inner>
        </xo-carousel>
      </div>
      <div class='product-v1__box'>
        <div>
          <h2 class='product-v4__collection-title product-v4__item2'>
            {{ section.settings.collection2_title }}
          </h2>
        </div>
        <xo-carousel
          xo-vertical
          xo-per-view='{{ section.settings.rows_limit }}'
          xo-gap='10'
          xo-speed='400'
          {% if section.settings.auto_play %}
            xo-autoplay='5000'
          {% endif %}
        >
          <xo-carousel-inner class='product-v4__carousel-inner' style='--aspect-ratio: {{ section.settings.aspect_ratio }}'>
            <xo-carousel-list>
              {% for product in section.settings.collection2.products limit: section.settings.products_limit %}
                <xo-carousel-slide class='product-v4__item-wrap'>
                  <div class='product-v4__item product-v4__item2'>
                    <a href='{{ product.url }}' class='{% render 'hover-style' %} product-v4__product-image'>
                      {% render 'image', image: product.featured_image, media_aspect_ratio: section.settings.aspect_ratio %}
                    </a>
                    <div>
                      <a href='{{ product.url }}'>
                        <h3 class='product-v4__product-title'>{{ product.title }}</h3>
                      </a>
                      <div class='product-v4__price'>
                        <span>{{ product.price | money }}</span>
                        <del>{{ product.compare_at_price | money }}</del>
                      </div>
                    </div>
                  </div>
                </xo-carousel-slide>
              {% endfor %}
            </xo-carousel-list>
          </xo-carousel-inner>
        </xo-carousel>
      </div>
      <div class='product-v4__banner'>
        <a href='{{ section.settings.banner_link }}' class='product-v4__banner-image'>
          {% render 'image', image: section.settings.banner_image %}
        </a>
        <div class='product-v4__banner-content six-float'>
          <h3 class='product-v4__banner-title'>{{ section.settings.banner_title }}</h3>
          <div class='product-v4__banner-subtitle'>{{ section.settings.banner_subtitle }}</div>
          {% render 'button',
            text: section.settings.button_text,
            link: section.settings.banner_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>
      </div>
    </xo-grid>
  </xo-container>
</section>

{% schema %}
{
  "name": "t:sections.product_v4.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"
        },
        {
          "value": "sidepadding",
          "label": "t:sections.all.width.options__4.label"
        }
      ]
    },
    {
      "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": "range",
      "id": "gap",
      "min": 10,
      "max": 40,
      "step": 1,
      "unit": "px",
      "label": "t:sections.product_v4.settings.gap.label",
      "default": 30
    },
    {
      "type": "range",
      "id": "rows_limit",
      "min": 3,
      "max": 6,
      "step": 1,
      "label": "t:sections.product_v4.settings.rows_limit.label",
      "default": 3
    },
    {
      "type": "range",
      "id": "products_limit",
      "min": 2,
      "max": 20,
      "step": 1,
      "label": "t:sections.product_v4.settings.products_limit.label",
      "default": 6
    },
    {
      "type": "checkbox",
      "id": "auto_play",
      "label": "t:sections.product_v4.settings.auto_play.label",
      "default": false
    },
    {
      "type": "text",
      "id": "aspect_ratio",
      "label": "t:sections.product_v4.settings.aspect_ratio.label",
      "default": "1/1"
    },
    {
      "type": "header",
      "content": "t:sections.product_v4.settings.collection_header.content1"
    },
    {
      "type": "text",
      "id": "collection1_title",
      "label": "t:sections.product_v4.settings.collection_title.label",
      "default": "Featured Products"
    },
    {
      "type": "collection",
      "id": "collection1",
      "label": "t:sections.product_v4.settings.collection.label"
    },
    {
      "type": "header",
      "content": "t:sections.product_v4.settings.collection_header.content2"
    },
    {
      "type": "text",
      "id": "collection2_title",
      "label": "t:sections.product_v4.settings.collection_title.label",
      "default": "Onsale Products"
    },
    {
      "type": "collection",
      "id": "collection2",
      "label": "t:sections.product_v4.settings.collection.label"
    },
    {
      "type": "header",
      "content": "t:sections.product_v4.settings.banner_header.content"
    },
    {
      "type": "text",
      "id": "banner_title",
      "label": "t:sections.product_v4.settings.banner_title.label",
      "default": "HousePlants"
    },
    {
      "type": "text",
      "id": "banner_subtitle",
      "label": "t:sections.product_v4.settings.banner_subtitle.label",
      "default": "Life Gathers Around Plants"
    },
    {
      "type": "color",
      "id": "color_text",
      "label": "t:sections.product_v4.settings.color_text.label",
      "default": "#ffffff"
    },
    {
      "type": "image_picker",
      "id": "banner_image",
      "label": "t:sections.product_v4.settings.banner_image.label",
      "info": "t:sections.product_v4.settings.image.info"
    },
    {
      "type": "url",
      "id": "banner_link",
      "label": "t:sections.product_v4.settings.banner_link.label",
      "default": "/collections/all"
    },
    {
      "type": "header",
      "content": "t:sections.all.button_heading.content"
    },
    {
      "type": "text",
      "id": "button_text",
      "label": "t:sections.all.button_text.label",
      "default": "ALL PRODUCTS"
    },
    {
      "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
    }
  ],
  "presets": [
    {
      "name": "t:sections.product_v4.presets.name"
    }
  ]
}
{% endschema %}
