{{ 'section-instagram-v1.css' | asset_url | stylesheet_tag }}
<section {% render 'section-attr' %}>
  <xo-animate>
    <xo-container {% render 'section-layout' %}>
      <div class='instagram-v3'>
        {% render 'ig-heading-cosmetic', title: section.settings.title %}

        <xo-instagram
          xo-open-mode='modal'
          xo-access-token='{{section.settings.ins_access_token}}'
        >
          <xo-carousel
            xo-per-move='1'
            xo-per-view='{{section.settings.limit_image}}'
            xo-gap='0'
            xo-loop
            xo-speed='2000'
            xo-hover-pause='true'
            {% if section.settings.auto_play %}
              xo-autoplay='5000'
            {% endif %}
            xo-breakpoints='
              {
                600: {
                  perView: 2,
                  perMove: 1,
                },
                900: {
                  perView: 4,
                  perMove: 1,
                },
                800: {
                  perView: 3,
                  perMove: 1,
                },
                1000: {
                  perView: 5,
                  perMove: 1,
                },
              }
            '
          >
            <xo-carousel-inner>
              <xo-carousel-list>
                {% if section.settings.ins_access_token == blank %}
                  {% assign b = section.settings.limit_image %}
                  {% assign a = b | plus: 1 %}
                  {% for i in (1..a) %}
                    <xo-carousel-slide>
                      {% render 'instagram-cosmetic', i: i %}
                    </xo-carousel-slide>
                  {% endfor %}
                {% else %}
                  <xo-instagram-template>
                    <img class='instagram-v3__img-ig' data-src='{ url }' alt='' width='1000' height='1000'>
                    <div class='instagram-v3__icon-ig'>
                      {{ section.settings.item_icon }}
                    </div>
                  </xo-instagram-template>
                {% endif %}
              </xo-carousel-list>
            </xo-carousel-inner>
          </xo-carousel>
        </xo-instagram>
      </div>
    </xo-container>
  </xo-animate>
</section>

{% schema %}
{
  "name": "t:sections.instagram_v1.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "t:sections.all.title.label",
      "default": "Follow us on instagram"
    },
    {
      "type": "text",
      "id": "ins_access_token",
      "label": "t:sections.instagram_v1.settings.ins_access_token.label",
      "info": "[Get access token](https://developers.facebook.com/docs/instagram-basic-display-api/getting-started)"
    },
    {
      "type": "html",
      "id": "item_icon",
      "label": "t:sections.instagram_v1.settings.item_icon.label",
      "default": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" viewbox=\"0 0 448 512\"><path d=\"M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z \"></path></svg>"
    },
    {
      "type": "range",
      "id": "limit_image",
      "min": 3,
      "max": 6,
      "step": 1,
      "label": "t:sections.instagram_v1.settings.limit_image.label",
      "default": 6
    },
    {
      "type": "checkbox",
      "id": "auto_play",
      "label": "t:sections.instagram_v1.settings.auto_play.label",
      "default": false
    },
    {
      "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": "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
    }
  ],
  "presets": [
    {
      "name": "t:sections.instagram_v1.presets.name",
      "category": "Text"
    }
  ]
}
{% endschema %}
