{{ 'section-mega-menu-v2.css' | asset_url | stylesheet_tag }}
{% assign index_number = section.settings.index | append: '' %}

<template xo-mega-menu-name='header-mega-menu-v1' xo-mega-menu-index='{{ index_number }}'>
  <div data-id='{{ section.id }}' {% render 'section-attr' %}>
    <xo-container>
      <div>
        <xo-grid class='menu-header-v2-grid' style='--col-width: 24rem; --xo-grid-col-gap: 3rem; --xo-grid-row-gap: 0rem;'>
          {% if section.settings.image_1 != blank %}
            <div class='menu-header-v2'>
              <a class='menu-header-v2__img' href='{{section.settings.button_link1}}'>
                {% render 'image', image: section.settings.image_1 %}
              </a>
              <h4>
                <a class='menu-header-v2__link hover-style__link' href='{{section.settings.button_link1}}'> {{ section.settings.button_1 }}</a>
              </h4>
            </div>
          {% endif %}
          {% if section.settings.image_2 != blank %}
            <div class='menu-header-v2'>
              <a class='menu-header-v2__img' href='{{section.settings.button_link2}}'>
                {% render 'image', image: section.settings.image_2 %}
              </a>
              <h4>
                <a class='menu-header-v2__link hover-style__link' href='{{section.settings.button_link2}}'> {{ section.settings.button_2 }}</a>
              </h4>
            </div>
          {% endif %}
          {% if section.settings.image_3 != blank %}
            <div class='menu-header-v2'>
              <a class='menu-header-v2__img' href='{{section.settings.button_link3}}'>
                {% render 'image', image: section.settings.image_3 %}
              </a>
              <h4>
                <a class='menu-header-v2__link hover-style__link' href='{{section.settings.button_link3}}'> {{ section.settings.button_3 }}</a>
              </h4>
            </div>
          {% endif %}
          {% if section.settings.image_4 != blank %}
            <div class='menu-header-v2'>
              <a class='menu-header-v2__img' href='{{section.settings.button_link4}}'>
                {% render 'image', image: section.settings.image_4 %}
              </a>
              <h4>
                <a class='menu-header-v2__link hover-style__link' href='{{section.settings.button_link4}}'> {{ section.settings.button_4 }}</a>
              </h4>
            </div>
          {% endif %}
          {% if section.settings.image_5 != blank %}
            <div class='menu-header-v2 '>
              <a class='menu-header-v2__img' href='{{section.settings.button_link5}}'>
                {% render 'image', image: section.settings.image_5 %}
              </a>
              <h4>
                <a class='menu-header-v2__link hover-style__link' href='{{section.settings.button_link5}}'> {{ section.settings.button_5 }}</a>
              </h4>
            </div>
          {% endif %}
        </xo-grid>
      </div>
    </xo-container>
  </div>
</template>

{% schema %}
{
  "name": "t:sections.mega_menu_v2.name",
  "class": "section-mega-menu",
  "settings": [
    {
      "type": "select",
      "id": "index",
      "label": "t:sections.mega_menu_v2.settings.index_number.label",
      "options": [
        {
          "value": "0",
          "label": "t:sections.mega_menu_v2.settings.index_number.option_1.label"
        },
        {
          "value": "1",
          "label": "t:sections.mega_menu_v2.settings.index_number.option_2.label"
        },
        {
          "value": "2",
          "label": "t:sections.mega_menu_v2.settings.index_number.option_3.label"
        },
        {
          "value": "3",
          "label": "t:sections.mega_menu_v2.settings.index_number.option_4.label"
        },
        {
          "value": "4",
          "label": "t:sections.mega_menu_v2.settings.index_number.option_5.label"
        },
        {
          "value": "5",
          "label": "t:sections.mega_menu_v2.settings.index_number.option_6.label"
        }
      ],
      "default": "0"
    },
    {
      "type": "image_picker",
      "id": "image_1",
      "label": "t:sections.mega_menu_v2.settings.image_1.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "text",
      "id": "button_1",
      "label": "t:sections.mega_menu_v2.settings.button_1.label",
      "default": "Collection"
    },
    {
      "type": "url",
      "id": "button_link1",
      "label": "t:sections.mega_menu_v2.settings.button_link1.label",
      "default": "/collections/all"
    },
    {
      "type": "image_picker",
      "id": "image_2",
      "label": "t:sections.mega_menu_v2.settings.image_2.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "text",
      "id": "button_2",
      "label": "t:sections.mega_menu_v2.settings.button_2.label",
      "default": "Collection"
    },
    {
      "type": "url",
      "id": "button_link2",
      "label": "t:sections.mega_menu_v2.settings.button_link2.label",
      "default": "/collections/all"
    },
    {
      "type": "image_picker",
      "id": "image_3",
      "label": "t:sections.mega_menu_v2.settings.image_3.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "text",
      "id": "button_3",
      "label": "t:sections.mega_menu_v2.settings.button_3.label",
      "default": "Collection"
    },
    {
      "type": "url",
      "id": "button_link3",
      "label": "t:sections.mega_menu_v2.settings.button_link3.label",
      "default": "/collections/all"
    },
    {
      "type": "image_picker",
      "id": "image_4",
      "label": "t:sections.mega_menu_v2.settings.image_4.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "text",
      "id": "button_4",
      "label": "t:sections.mega_menu_v2.settings.button_4.label",
      "default": "Collection"
    },
    {
      "type": "url",
      "id": "button_link4",
      "label": "t:sections.mega_menu_v2.settings.button_link4.label",
      "default": "/collections/all"
    },
    {
      "type": "image_picker",
      "id": "image_5",
      "label": "t:sections.mega_menu_v2.settings.image_5.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "text",
      "id": "button_5",
      "label": "t:sections.mega_menu_v2.settings.button_5.label",
      "default": "Collection"
    },
    {
      "type": "url",
      "id": "button_link5",
      "label": "t:sections.mega_menu_v2.settings.button_link5.label",
      "default": "/collections/all"
    },
    {
      "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.mega_menu_v2.presets.name"
    }
  ]
}
{% endschema %}
