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

        <xo-instagram
          xo-limit='5'
          xo-open-mode='newtab'
          xo-access-token='{{section.settings.ins_access_token}}'
        >
          <xo-grid style='--xs: 1; --sm: 1; --md:5; --lg: 5;  --xo-grid-col-gap: 0px;--xo-grid-row-gap: 0px'>
            {% if section.settings.ins_access_token == blank %}
              {% for i in (1..5) %}
                <div class='instagram-v1__box'>
                  <div class='instagram-v1__box-img'>
                    <img src='{{ 'instagram' | append: i | append: '.jpg' | file_img_url: 'master' }}' class='instagram-v1__image' alt='instagram' width='1000' height='1000'>
                  </div>
                  <div class='instagram-v1__item-link'>
                    <a href='https://www.instagram.com/' class='instagram-v1__link' target='_blank'>{{ section.settings.item_icon }}</a>
                  </div>
                </div>
              {% endfor %}
            {% else %}
              <xo-instagram-template>
                <img class='instagram-v1__img-token' data-src='{ url }' alt='' width='1000' height='1000'>
                <div class='instagram-v1__icon-ig'>
                  {{ section.settings.item_icon }}
                </div>
              </xo-instagram-template>
            {% endif %}
          </xo-grid>
        </xo-instagram>
      </div>
    </xo-container>
  </xo-animate>
</section>

{% schema %}
{
  "name": "t:sections.instagram_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": "text",
      "id": "title",
      "label": "t:sections.all.title.label",
      "default": "FODEN ON INSTAGRAM "
    },
    {
      "type": "text",
      "id": "subtitle",
      "label": "t:sections.all.subtitle.label",
      "default": "@fodenshop"
    },
    {
      "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 \"/></svg>"
    },
    {
      "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"
    }
  ]
}
{% endschema %}
