{{ 'section-header-v2.css' | asset_url | stylesheet_tag }}

<header
  class='
      xo-header-v6 color-{{ section.settings.color_scheme }}
    {% if template contains 'index' or template contains 'home' %}
      {% if section.settings.transparent %}
        xo-header-v6--trans
      {% endif %}
    {% endif %}
  '
>
  <div
    {% if template contains 'index' or template contains 'home' %}
      {% if section.settings.transparent %}
        class='xo-header-v6__transparent'
      {% endif %}
    {% endif %}
    {% render 'section-attr' %}
  >
    <div class='header-v6-top'>
      <xo-container class='{% if section.settings.width == 'unset' %} xo-container-width{% endif %} '>
        {% if section.settings.check_topbar %}
          <xo-grid class='header-v6-top__grid' style='--xs: 2'>
            <div class='header-v6-top__left'>
              {% if section.settings.phone != blank %}
                <div class='header-v6-top__left-phone'>
                  <strong class='header-v6-top__context-phone'>Call 24/7 :</strong>
                  <div class='header-v6-top__phone'>{{ section.settings.phone }}</div>
                </div>
              {% endif %}
              {% if section.settings.email != blank %}
                <div class='header-v6-top__box-email'>
                  <div class='header-v6-top__email'>
                    <a href='#'>{{ section.settings.email }}</a>
                  </div>
                </div>
              {% endif %}
            </div>
            <div class='header-v6-top__right'>
              <div class='header-v6-top__list-icon'>
                {% if section.settings.button_link1 %}
                  <a href='{{section.settings.button_link1 }}' class='header-v6-top__icon'>{{ section.settings.icon_fb }}</a>
                {% endif %}
                {% if section.settings.button_link2 %}
                  <a href='{{section.settings.button_link2 }}' class='header-v6-top__icon'>{{ section.settings.icon_yt }}</a>
                {% endif %}
                {% if section.settings.button_link3 %}
                  <a href='{{section.settings.button_link3 }}' class='header-v6-top__icon'>{{ section.settings.icon_ig }}</a>
                {% endif %}
                {% if section.settings.button_link4 %}
                  <a href='{{section.settings.button_link4 }}' class='header-v6-top__icon'>{{ section.settings.icon_tw }}</a>
                {% endif %}
              </div>
              <div class='header-v6-top__currency'>
                {% if section.settings.country_selector %}
                  {% render 'currency-select' %}
                {% endif %}
              </div>
              <div class='header-v6-top__language'>
                {% if section.settings.language_selector %}
                  {% render 'language-select' %}
                {% endif %}
              </div>
            </div>
          </xo-grid>
        {% endif %}
      </xo-container>
    </div>
    <xo-sticky
      xo-direction='{{ section.settings.sticky_header_type }}'
      {% if section.settings.sticky_header_type == 'none' %}
        xo-disabled
      {% endif %}
      style='z-index: 10000'
    >
      <xo-animate
        xo-type='fade-up'
        class='
          xo-header-v6__sticky {% if section.settings.transparent %}
            xo-header-v6__sticky--trans
          {% endif %}
        '
      >
        <xo-container class='{% if section.settings.width == 'unset' %} xo-container-width{% endif %} '>
          <xo-grid class='xo-header-v6__content'>
            <div
              {% if section.settings.menu_type == 'drawer' %}
                style='--xs: 4; --xl: 4'
              {% else %}
                style='--xs: 4; --xl: 2'
              {% endif %}
              class='
                xo-header-v6__center {% if section.settings.menu_type == 'drawer' %}
                  xo-header-v6__center--order
                {% endif %}
              '
            >
              <a href='/' class='xo-header-v6__logo'>
                {%- if section.settings.logo != blank -%}
                  {%- assign logo_alt = section.settings.logo.alt | default: shop.name | escape -%}
                  {%- assign logo_height = section.settings.logo_width | divided_by: section.settings.logo.aspect_ratio -%}
                  {{
                    section.settings.logo
                    | image_url: width: section.settings.logo_width
                    | image_tag:
                      class: 'xo-header-v6__logo-img',
                      widths: '50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250',
                      height: logo_height,
                      width: section.settings.logo_width,
                      alt: logo_alt
                  }}
                {%- else -%}
                  <span class='h4 xo-header-v6__logo-heading-logo'>{{ shop.name }}</span>
                {%- endif -%}
              </a>
              <a href='/' class='xo-header-v6__logo-mobile'>
                {%- if section.settings.logo_mobile != blank -%}
                  {%- assign logo_alt = section.settings.logo_mobile.alt | default: shop.name | escape -%}
                  {%- assign logo_height = section.settings.mobile_width | divided_by: section.settings.logo.aspect_ratio -%}
                  {{
                    section.settings.logo_mobile
                    | image_url: width: section.settings.mobile_width
                    | image_tag:
                      class: 'xo-header-v6__logo-img',
                      widths: '50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250',
                      height: logo_height,
                      width: section.settings.mobile_width,
                      alt: logo_alt
                  }}
                {%- else -%}
                  <span class='h4 xo-header-v6__logo-heading-logo'>{{ shop.name }}</span>
                {%- endif -%}
              </a>
            </div>
            <nav
              {% if section.settings.menu_type == 'drawer' %}
                style='--xs: 4; --xl: 4'
              {% else %}
                style='--xs: 4; --xl: 8'
              {% endif %}
              class='
                xo-header-v6__left {% if section.settings.menu_type == 'drawer' %}
                  xo-header-v6__left--order
                {% endif %}
              '
            >
              <div class='xo-header-v6__desktop{% if section.settings.menu_type == 'drawer' %} xo-header-v6__desktop--only{% endif %}'>
                {% if section.settings.menu_type == 'default' %}
                  {% render 'menu-horizontal-v1', menu: section.settings.menu, event_type: section.settings.event_type %}
                {% else %}
                  {% render 'menu-hamburger-style1', menu: section.settings.menu, hamburger_type: section.settings.hamburger_type, menu_type: section.settings.menu_type %}
                {% endif %}
              </div>
              {% if section.settings.menu_type == 'default' %}
                <div class='xo-header-v6__mobile'>
                  {% render 'menu-hamburger-style1', menu: section.settings.menu, hamburger_type: section.settings.hamburger_type, menu_type: section.settings.menu_type %}
                </div>
              {% endif %}
            </nav>
            <div
              {% if section.settings.menu_type == 'drawer' %}
                style='--xs: 4; --xl: 4'
              {% else %}
                style='--xs: 4; --xl: 2'
              {% endif %}
              class='xo-header-v6__right'
            >
              <xo-tooltip xo-title='Search' xo-placement='bottom-center'>
                <xo-modal-trigger
                  class='xo-header-v6__right-item'
                  xo-name='search'
                >
                  {% render 'icon', name: 'search', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                </xo-modal-trigger>
              </xo-tooltip>
              <xo-tooltip
                xo-title='{%- if customer -%}{{ 'customer.account.title' | t }}{%- else -%}{{ 'customer.login_page.title' | t }}{%- endif -%}'
                xo-placement='bottom-center'
              >
                <a
                  href='{%- if customer -%}{{ routes.account_url }}{%- else -%}{{ routes.account_login_url }}{%- endif -%}'
                  class='xo-header-v6__right-item xo-header-v6__right-item--account'
                >
                  {% render 'icon', name: 'account1', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                </a>
              </xo-tooltip>
              <xo-tooltip xo-title='Wishlist' xo-placement='bottom-center'>
                <a href='#' class='xo-header-v6__right-item xo-header-v6__right-item--heart'>
                  {% render 'icon', name: 'heart', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                </a>
              </xo-tooltip>
              <xo-tooltip xo-title='Cart' xo-placement='bottom-center'>
                {% if settings.cart_type == 'page' %}
                  <a class='xo-header-v6__right-item' href='{{ routes.cart_url }}'>
                    {% render 'icon', name: 'cart', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                    <div class='xo-header-v6__right-item-number'>
                      <xo-cart-size>{{ cart.item_count }}</xo-cart-size>
                    </div>
                  </a>
                {% else %}
                  <xo-modal-trigger
                    class='xo-header-v6__right-item'
                    xo-name='cart'
                  >
                    {% render 'icon', name: 'cart', icon_size: '24' %}
                    <div class='xo-header-v6__right-item-number'>
                      <xo-cart-size>{{ cart.item_count }}</xo-cart-size>
                    </div>
                  </xo-modal-trigger>
                {% endif %}
              </xo-tooltip>
            </div>
          </xo-grid>
        </xo-container>
      </xo-animate>
    </xo-sticky>
  </div>
</header>

{% render 'header-ld-json' %}

{% schema %}
{
  "name": "t:sections.header_v2.name",
  "class": "section-header",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.header_v2.settings.width.label",
      "default": "1400",
      "options": [
        {
          "value": "1400",
          "label": "t:sections.header_v2.settings.width.option_1.label"
        },
        {
          "value": "unset",
          "label": "t:sections.header_v2.settings.width.option_2.label"
        }
      ]
    },
    {
      "type": "header",
      "content": "Topbar setting"
    },
    {
      "type": "checkbox",
      "id": "check_topbar",
      "default": true,
      "label": "t:sections.header_v2.settings.check_topbar.label"
    },
    {
      "type": "text",
      "id": "phone",
      "label": "t:sections.header_v2.settings.phone.label"
    },
    {
      "type": "text",
      "id": "email",
      "label": "t:sections.header_v2.settings.email.label"
    },
    {
      "type": "html",
      "id": "icon_fb",
      "label": "t:sections.header_v2.settings.icon_fb.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": "url",
      "id": "button_link1",
      "label": "t:sections.header_v2.settings.button_link1.label",
      "default": "/collections/all"
    },
    {
      "type": "html",
      "id": "icon_yt",
      "label": "t:sections.header_v2.settings.icon_yt.label"
    },
    {
      "type": "url",
      "id": "button_link2",
      "label": "t:sections.header_v2.settings.button_link2.label",
      "default": "/collections/all"
    },
    {
      "type": "html",
      "id": "icon_ig",
      "label": "t:sections.header_v2.settings.icon_ig.label"
    },
    {
      "type": "url",
      "id": "button_link3",
      "label": "t:sections.header_v2.settings.button_link3.label",
      "default": "/collections/all"
    },
    {
      "type": "html",
      "id": "icon_tw",
      "label": "t:sections.header_v2.settings.icon_tw.label"
    },
    {
      "type": "url",
      "id": "button_link4",
      "label": "t:sections.header_v2.settings.button_link4.label",
      "default": "/collections/all"
    },
    {
      "type": "checkbox",
      "id": "country_selector",
      "default": true,
      "label": "t:sections.header_v2.settings.country_selector.label"
    },
    {
      "type": "checkbox",
      "id": "language_selector",
      "default": true,
      "label": "t:sections.header_v2.settings.language_selector.label"
    },
    {
      "type": "header",
      "content": "Header setting"
    },
    {
      "type": "checkbox",
      "id": "transparent",
      "default": false,
      "label": "t:sections.header_v2.settings.transparent.label"
    },
    {
      "type": "image_picker",
      "id": "logo",
      "label": "t:sections.header_v2.settings.logo.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "range",
      "id": "logo_width",
      "min": 50,
      "max": 250,
      "step": 10,
      "default": 100,
      "unit": "t:sections.header_v2.settings.logo_width.unit",
      "label": "t:sections.header_v2.settings.logo_width.label"
    },
    {
      "type": "image_picker",
      "id": "logo_mobile",
      "label": "t:sections.header_v2.settings.logo_mobile.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "range",
      "id": "mobile_width",
      "min": 50,
      "max": 250,
      "step": 10,
      "default": 100,
      "unit": "t:sections.header_v2.settings.mobile_width.unit",
      "label": "t:sections.header_v2.settings.mobile_width.label"
    },
    {
      "type": "link_list",
      "id": "menu",
      "default": "main-menu",
      "label": "t:sections.header_v2.settings.menu.label"
    },
    {
      "type": "select",
      "id": "menu_type",
      "options": [
        {
          "value": "default",
          "label": "t:sections.header_v2.settings.menu_type.options__1.label"
        },
        {
          "value": "drawer",
          "label": "t:sections.header_v2.settings.menu_type.options__2.label"
        }
      ],
      "default": "default",
      "label": "t:sections.header_v2.settings.menu_type.label"
    },
    {
      "type": "select",
      "id": "hamburger_type",
      "options": [
        {
          "value": "default",
          "label": "t:sections.header_v2.settings.hamburger_type.options__1.label"
        },
        {
          "value": "drawer",
          "label": "t:sections.header_v2.settings.hamburger_type.options__2.label"
        },
        {
          "value": "horizontal",
          "label": "t:sections.header_v2.settings.hamburger_type.options__3.label"
        }
      ],
      "default": "default",
      "label": "t:sections.header_v2.settings.hamburger_type.label"
    },
    {
      "type": "select",
      "id": "sticky_header_type",
      "options": [
        {
          "value": "down",
          "label": "t:sections.header_v2.settings.sticky_header_type.options_1.label"
        },
        {
          "value": "up",
          "label": "t:sections.header_v2.settings.sticky_header_type.options_2.label"
        },
        {
          "value": "none",
          "label": "t:sections.header_v2.settings.sticky_header_type.options_3.label"
        }
      ],
      "default": "down",
      "label": "t:sections.header_v2.settings.sticky_header_type.label"
    },
    {
      "type": "select",
      "id": "event_type",
      "options": [
        {
          "value": "hover",
          "label": "t:sections.header_v2.settings.event_type.options_1.label"
        },
        {
          "value": "click",
          "label": "t:sections.header_v2.settings.event_type.options_2.label"
        }
      ],
      "default": "hover",
      "label": "t:sections.header_v2.settings.event_type.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
    }
  ]
}
{% endschema %}
