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

<div {% render 'section-attr' %}>
  {% render 'section-bg-image' %}
  <xo-container
    class='
      {% if section.settings.width == "unset" %}
        xo-container--wide
      {%- endif -%}
    '
  >
    <xo-animate
      xo-type='fade-up'
      xo-delay='100'
      xo-duration='1000'
    >
      <div class='new21__title' style='--text-align: {{ section.settings.text_align}}'>
        <h2>{{ section.settings.title }}</h2>
      </div>
      <div class='new21__description' style='--text-align: {{ section.settings.text_align}}'>
        <p>
          {{ section.settings.description }}
        </p>
      </div>
    </xo-animate>
    <xo-animate
      xo-type='fade-up'
      xo-delay='100'
      xo-duration='1000'
    >
      <xo-carousel
        xo-breakpoints='
          {
            700: {
              perView: 1,
            },
            900: {
              perView: 2,
            },
            1000: {
              perView: 3,
            },
          }
        '
        {% if section.settings.autoplay %}
          xo-autoplay='3000'
        {% endif %}
        xo-per-view='{{ section.settings.columns_carousel1 }}'
        xo-speed='400'
        xo-gap='{{ section.settings.columns_spacing }}'
        xo-rewind
        xo-render-bullet="<span class='new21__bullet'></span>"
      >
        <xo-carousel-inner>
          <xo-carousel-list>
            {% if section.settings.blog.articles != blank %}
              {%- paginate section.settings.blog.articles by section.settings.limit -%}
                {%- for article in section.settings.blog.articles -%}
                  <xo-carousel-slide>
                    {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                    {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                    {% render 'article-card-style24',
                      article: article,
                      show_image: section.settings.article_card_show_image,
                      media_aspect_ratio: section.settings.article_card_media_aspect_ratio,
                      show_date: section.settings.article_card_show_date,
                      show_author: section.settings.article_card_show_author,
                      show_excerpt: section.settings.article_card_show_excerpt,
                      show_tags: section.settings.article_card_show_tags,
                      placeholder_image: placeholder_image,
                      color_scheme: section.settings.article_card_color_scheme
                    %}
                  </xo-carousel-slide>
                {%- endfor -%}
              {%- endpaginate -%}
            {% endif %}
          </xo-carousel-list>
        </xo-carousel-inner>
        <xo-carousel-prev class='new21__btn-prev'>
          <button>
            {%- render 'icon', name: 'chevron-left', icon_size: '21', color: 'rgba(var(--color-foreground))' -%}
          </button>
        </xo-carousel-prev>
        <xo-carousel-next class='new21__btn-next'>
          <button>
            {%- render 'icon', name: 'chevron-right', icon_size: '21', color: 'rgba(var(--color-foreground))' -%}
          </button>
        </xo-carousel-next>
        <xo-carousel-pagination class='new21__bullet-list'></xo-carousel-pagination>
      </xo-carousel>
    </xo-animate>
  </xo-container>
</div>

{% schema %}
{
  "name": "t:sections.blog_v1.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.blog_v1.settings.width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.blog_v1.settings.width.option_1.label"
        },
        {
          "value": "unset",
          "label": "t:sections.blog_v1.settings.width.option_2.label"
        }
      ]
    },
    {
      "type": "select",
      "id": "text_align",
      "label": "t:sections.blog_v1.settings.text_align.label",
      "default": "center",
      "options": [
        {
          "value": "left",
          "label": "t:sections.blog_v1.settings.text_align.option_3.label"
        },
        {
          "value": "center",
          "label": "t:sections.blog_v1.settings.text_align.option_1.label"
        },
        {
          "value": "right",
          "label": "t:sections.blog_v1.settings.text_align.option_2.label"
        }
      ]
    },
    {
      "type": "text",
      "id": "title",
      "label": "t:sections.all.title.label",
      "default": "DEFAULT TITLE"
    },
    {
      "type": "text",
      "id": "description",
      "label": "t:sections.blog_v1.settings.description.label",
      "default": "Description"
    },
    {
      "type": "select",
      "id": "hover",
      "label": "t:sections.all.hover.label",
      "default": "hover1",
      "options": [
        {
          "value": "hover1",
          "label": "t:sections.all.hover.option__1.label"
        },
        {
          "value": "hover2",
          "label": "Style 02"
        },
        {
          "value": "hover3",
          "label": "Style 03"
        },
        {
          "value": "hover4",
          "label": "Style 04"
        },
        {
          "value": "hover5",
          "label": "Style 05"
        },
        {
          "value": "hover6",
          "label": "Style 06"
        }
      ]
    },
    {
      "type": "blog",
      "id": "blog",
      "label": "t:sections.blog_v1.settings.blog.label"
    },
    {
      "type": "checkbox",
      "id": "autoplay",
      "label": "t:sections.blog_v1.settings.autoplay.label",
      "default": false
    },
    {
      "type": "range",
      "id": "limit",
      "min": 2,
      "max": 20,
      "step": 1,
      "default": 12,
      "label": "t:sections.blog_v1.settings.limit.label"
    },
    {
      "type": "range",
      "label": "t:sections.blog_v1.settings.columns_spacing.label",
      "id": "columns_spacing",
      "min": 0,
      "max": 80,
      "step": 1,
      "default": 30
    },
    {
      "type": "range",
      "id": "columns_carousel1",
      "min": 2,
      "max": 5,
      "step": 1,
      "label": "t:sections.blog_v1.settings.columns_carousel.label",
      "default": 3
    },
    {
      "type": "header",
      "content": "t:sections.all.article_card_header.content"
    },
    {
      "type": "checkbox",
      "id": "article_card_show_image",
      "default": true,
      "label": "t:sections.all.article_card_show_image.label"
    },
    {
      "type": "checkbox",
      "id": "article_card_show_date",
      "default": true,
      "label": "t:sections.all.article_card_show_date.label"
    },
    {
      "type": "checkbox",
      "id": "article_card_show_excerpt",
      "default": false,
      "label": "t:sections.all.article_card_show_excerpt.label"
    },
    {
      "type": "color_scheme",
      "id": "article_card_color_scheme",
      "default": "scheme_1",
      "label": "t:sections.all.article_card_color_scheme.label"
    },
    {
      "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.blog_v1.presets.name",
      "settings": {
        "blog": "Test"
      }
    }
  ]
}
{% endschema %}
