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

<header
  class='
    xo-header-v18 color-{{ section.settings.color_scheme }}
     {% if section.settings.transparent and template contains 'index' or template contains 'home' %}
      xo-header-v18--trans
    {% endif %}
  '
>
  <div
    {% if section.settings.transparent and template contains 'index' or template contains 'home' %}
      class='xo-header-v18__transparent'
    {% endif %}
    {% render 'section-attr' %}
  >
    {% if section.settings.check_topbar %}
      <div class='header-v18-top' style='--background-menu:{{ section.settings.var_background }}; --text-menu:{{ section.settings.menu_text }}'>
        <xo-container class='{% if section.settings.width == 'unset' %} xo-container-width{% endif %} '>
          <xo-grid>
            <div style='--xs: 3' class='header-v18-top__list-icon'>
              {% if section.settings.button_link1 %}
                <a href='{{section.settings.button_link1 }}' class='header-v18-top__icon'>{{ section.settings.icon_fb }}</a>
              {% endif %}
              {% if section.settings.button_link2 %}
                <a href='{{section.settings.button_link2 }}' class='header-v18-top__icon'>{{ section.settings.icon_yt }}</a>
              {% endif %}
              {% if section.settings.button_link3 %}
                <a href='{{section.settings.button_link3 }}' class='header-v18-top__icon'>{{ section.settings.icon_ig }}</a>
              {% endif %}
              {% if section.settings.button_link4 %}
                <a href='{{section.settings.button_link4 }}' class='header-v18-top__icon'>{{ section.settings.icon_tw }}</a>
              {% endif %}
            </div>
            <div style='--xs: 9' class='header-v18-top__right'>
              {% if section.settings.phone != blank %}
                <div class='header-v18-top__right-item'>
                  <div class='header-v18-top__right-icon'>
                    {% render 'icon', name: 'phone2', icon_size: '16', color: 'var(--text-menu)' %}
                  </div>
                  <div class='header-v18-top__context'>
                    <a href='#'>{{ section.settings.phone }}</a>
                  </div>
                </div>
              {% endif %}
              {% if section.settings.email != blank %}
                <div class='header-v18-top__right-item'>
                  <div class='header-v18-top__right-icon'>
                    {% render 'icon', name: 'email2', icon_size: '16', color: 'var(--text-menu)' %}
                  </div>
                  <div class='header-v18-top__context'>
                    <a href='#'>{{ section.settings.email }}</a>
                  </div>
                </div>
              {% endif %}
              {% if section.settings.address != blank %}
                <div class='header-v18-top__right-item'>
                  <div class='header-v18-top__right-icon'>
                    {% render 'icon', name: 'location1', icon_size: '16', color: 'var(--text-menu)' %}
                  </div>
                  <div class='header-v18-top__context'>
                    {{ section.settings.address }}
                  </div>
                </div>
              {% endif %}
            </div>
          </xo-grid>
        </xo-container>
      </div>
    {% endif %}
    <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-v18__sticky
          {% if section.settings.transparent and template contains 'index' or template contains 'home' %}
            xo-header-v18__sticky--trans
          {% endif %}
        '
      >
        <xo-container class='{% if section.settings.width == 'unset' %} xo-container-width{% endif %} '>
          <xo-grid class='xo-header-v18__content'>
            <div
              {% if section.settings.menu_type == 'drawer' %}
                style='--xs: 4'
              {% else %}
                style='--xs: 4;--xl: 3'
              {% endif %}
              class='
                xo-header-v18__center {% if section.settings.menu_type == 'drawer' %}
                  xo-header-v18__center--order
                {% endif %}
              '
            >
              <a href='/' class='xo-header-v18__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-v18__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-v18__logo-heading-logo'>{{ shop.name }}</span>
                {%- endif -%}
              </a>
              <a href='/' class='xo-header-v18__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-v18__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-v18__logo-heading-logo'>{{ shop.name }}</span>
                {%- endif -%}
              </a>
            </div>
            <nav
              {% if section.settings.menu_type == 'drawer' %}
                style='--xs: 4'
              {% else %}
                style='--xs: 4;--xl: 6'
              {% endif %}
              class='
                xo-header-v18__left {% if section.settings.menu_type == 'drawer' %}
                  xo-header-v18__left--order
                {% endif %}
              '
            >
              <div class='xo-header-v18__desktop{% if section.settings.menu_type == 'drawer' %} xo-header-v18__desktop--only{% endif %}'>
                {% if section.settings.menu_type == 'default' %}
                  {% render 'menu-horizontal-v1',
                    menu: section.settings.menu,
                    event_type: section.settings.event_type,
                    image: section.settings.logo,
                    color_text: section.settings.color_text,
                    background_menu: section.settings.background_menu
                  %}
                {% 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-v18__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'
              {% else %}
                style='--xs: 4;--xl: 3'
              {% endif %}
              class='xo-header-v18__right'
            >
              <xo-tooltip xo-title='Search' xo-placement='bottom-center'>
                <xo-modal-trigger
                  class='xo-header-v18__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-v18__right-item xo-header-v18__right-item--account'
                >
                  {% render 'icon', name: 'account1', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                </a>
              </xo-tooltip>
              <xb-wishlist-header class='xb-wishlist__header'>
                <xo-tooltip xo-title='Wishlist' xo-placement='bottom-center'>
                  <a href='#' class='xo-header-v18__right-item xo-header-v18__right-item--heart'>
                    {% render 'icon', name: 'heart1', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                  </a>
                </xo-tooltip>
              </xb-wishlist-header>
              <xo-tooltip xo-title='Cart' xo-placement='bottom-center'>
                {% if settings.cart_type == 'page' %}
                  <a class='xo-header-v18__right-item' href='{{ routes.cart_url }}'>
                    {% render 'icon', name: 'cart', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                    <div class='xo-header-v18__right-item-number'>
                      <xo-cart-size>{{ cart.item_count }}</xo-cart-size>
                    </div>
                  </a>
                {% else %}
                  <xo-modal-trigger
                    class='xo-header-v18__right-item'
                    xo-name='cart'
                  >
                    {% render 'icon', name: 'cart', icon_size: '24', color: 'rgb(var(--color-foreground))' %}
                    <div class='xo-header-v18__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": "color",
      "id": "var_background",
      "label": "t:sections.header_v2.settings.var_background.label"
    },
    {
      "type": "color",
      "id": "menu_text",
      "label": "t:sections.header_v2.settings.menu_text.label"
    },
    {
      "type": "html",
      "id": "icon_fb",
      "label": "t:sections.header_v2.settings.icon_fb.label",
      "default": "<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewbox=\"0 0 150 150\" style=\"enable-background:new 0 0 150 150;\" height=\"1em\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\">\n  <g>\n   <path d=\"M131.95,12.84c-5.03,5.87-10.06,11.74-15.1,17.6c-9.93,11.54-19.88,23.07-29.81,34.6c-0.11,0.12-0.2,0.25-0.37,0.47\n     c16.38,23.8,32.77,47.61,49.27,71.57c-0.51,0.03-0.84,0.07-1.18,0.07c-11.35,0-22.7-0.01-34.06,0.02c-0.78,0-1.22-0.24-1.67-0.89\n     c-10.58-15.41-21.18-30.79-31.78-46.18c-0.25-0.36-0.51-0.71-0.82-1.14c-2.93,3.39-5.79,6.7-8.64,10.01\n     c-10.7,12.42-21.41,24.84-32.09,37.28c-0.59,0.68-1.18,0.94-2.07,0.92c-3.07-0.05-6.15-0.02-9.54-0.02\n     c15.95-18.51,31.74-36.82,47.57-55.19c-2.56-3.72-5.09-7.41-7.63-11.1C40.93,51.86,27.85,32.87,14.78,13.88\n     c-0.22-0.33-0.38-0.7-0.57-1.04c12.08,0,24.16,0,36.25,0c0.08,0.14,0.15,0.28,0.24,0.42c10.22,14.85,20.44,29.71,30.67,44.56\n     c0.13,0.19,0.29,0.36,0.5,0.6c0.35-0.38,0.66-0.68,0.94-1.01c11.76-13.64,23.51-27.27,35.26-40.92c1.02-1.18,1.96-2.43,2.94-3.64\n     C124.65,12.84,128.3,12.84,131.95,12.84z M121.13,129.4c-0.24-0.4-0.34-0.58-0.45-0.74C95.71,93.01,70.74,57.36,45.74,21.73\n     c-0.3-0.43-1.04-0.77-1.58-0.77c-4.78-0.06-9.57-0.04-14.35-0.03c-0.26,0-0.53,0.03-0.99,0.06c0.4,0.59,0.68,1.02,0.97,1.44\n     c8.98,12.82,17.97,25.65,26.95,38.47c15.78,22.53,31.57,45.06,47.33,67.61c0.48,0.68,0.97,0.93,1.78,0.92\n     c4.66-0.04,9.32-0.02,13.99-0.02C120.2,129.4,120.55,129.4,121.13,129.4\"></path>\n  </g>\n</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": "text",
      "id": "phone",
      "label": "t:sections.header_v2.settings.phone.label"
    },
    {
      "type": "text",
      "id": "email",
      "label": "t:sections.header_v2.settings.email.label"
    },
    {
      "type": "text",
      "id": "address",
      "label": "t:sections.header_v2.settings.address.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": "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": "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": "color",
      "id": "background_menu",
      "label": "t:sections.header_v2.settings.background_menu.label"
    },
    {
      "type": "color",
      "id": "color_text",
      "label": "t:sections.header_v2.settings.color_text.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 %}
