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

<header
  class='
    xo-header-v27 color-{{ section.settings.color_scheme }}
     {% if section.settings.transparent and template contains 'index' or template contains 'home' %}
      xo-header-v27--trans
    {% endif %}
  '
>
  <div
    {% if section.settings.transparent and template contains 'index' or template contains 'home' %}
      class='xo-header-v27__transparent'
    {% endif %}
    {% render 'section-attr' %}
  >
    <xo-sticky
      xo-direction='{{ section.settings.sticky_header_type }}'
      {% if section.settings.sticky_header_type == 'none' %}
        xo-disabled
      {% endif %}
      style='z-index: 10000'
    >
      <div
        class='
          xo-header-v27__sticky
          {% if section.settings.transparent and template contains 'index' or template contains 'home' %}
            xo-header-v27__sticky--trans
          {% endif %}
        '
      >
        <xo-container class='{% if section.settings.width == 'unset' %} xo-container-width{% endif %} '>
          <xo-grid class='xo-header-v27__content'>
            <div
              class='xo-header-v27__left'
              style='
                  {% if  section.settings.menu_type == 'drawer'  %}
                     --xs:2;
                  {% else %}
                --xl: 5;--xs:2;
                  {% endif %}
              '
            >
              <div class='xo-header-v27__desktop{% if section.settings.menu_type == 'drawer' %} xo-header-v27__desktop--only{% endif %}'>
                {% if section.settings.menu_type == 'default' %}
                  {% render 'menu-horizontal-v1',
                    menu: section.settings.menu,
                    event_type: section.settings.event_type,
                    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-v27__mobile'>
                  {% render 'menu-hamburger-style1', menu: section.settings.menu, hamburger_type: section.settings.hamburger_type, menu_type: section.settings.menu_type %}
                </div>
              {% endif %}
            </div>

            <div
              style='
                {% if  section.settings.menu_type == 'drawer'  %}
                   --xs: 8;
                {% else %}
                  --xs:8;--xl:2;
                {% endif %}
              '
              class='xo-header-v27__center'
            >
              <a
                href='/'
                class='xo-header-v27__logo-link'
              >
                {%- 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-v27__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
                  }}

                  {%- if section.settings.logo_mobile != blank -%}
                    {%- assign logo_alt = section.settings.logo_mobile.alt | default: shop.name | escape -%}
                    {%- assign logo_height = section.settings['logo_mobile-width'] | divided_by: section.settings.logo_mobile.aspect_ratio -%}
                    {{
                      section.settings.logo_mobile
                      | image_url: width: section.settings['logo_mobile-width']
                      | image_tag:
                        class: 'xo-header-v27__logo-img--mobile',
                        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_mobile-width'],
                        alt: logo_alt
                    }}
                  {%- endif -%}
                {%- else -%}
                  <span class='h4 xo-header-v27__logo-heading-logo'>{{ shop.name }}</span>
                {%- endif -%}
              </a>
            </div>

            <div
              {% if section.settings.menu_type == 'drawer' %}
                style='--xs: 2'
              {% else %}
                style='--xs: 2;  --xl: 5; '
              {% endif %}
              class='xo-header-v27__right'
            >
              {%- if section.settings.menu_type == 'default' -%}
                <div class='xo-header-v27__right-language'>
                  {% if section.settings.language_selector %}
                    {% render 'language-select' %}
                  {% endif %}
                </div>

                <div class='xo-header-v27__right-currency'>
                  {% if section.settings.country_selector %}
                    {% render 'currency-select' %}
                  {% endif %}
                </div>
              {%- endif -%}

              <xo-tooltip
                xo-title='{%- if customer -%}{{ 'customer.account.title' | t }}{%- else -%}{{ 'customer.login_page.title' | t }}{%- endif -%}'
                xo-placement='bottom-center'
              >
                <span class='xo-header-v27__right-item xo-header-v27__login'
                  ><a href='{%- if customer -%}{{ routes.account_url }}{%- else -%}{{ routes.account_login_url }}{%- endif -%}'>
                    {%- if customer -%}{{ 'customer.account.title' | t }}{%- else -%}{{ 'customer.login_page.title' | t }}{%- endif -%}
                  </a></span
                >
              </xo-tooltip>
              <xo-tooltip xo-title='Search' xo-placement='bottom-center'>
                <a href='#' class='xo-header-v27__right-item--search'>
                  <xo-modal-trigger
                    class='xo-header-v27__right-item'
                    xo-name='search'
                  >
                    {% render 'icon', name: 'search', icon_size: '22', color: 'rgb(var(--color-foreground))' %}
                  </xo-modal-trigger>
                </a>
              </xo-tooltip>
              <xo-tooltip xo-title='Search' xo-placement='bottom-center'>
                <a href='#' class='xo-header-v27__right-item xo-header-v27__right-item--search-mobile'>
                  <xo-modal-trigger
                    class='xo-header-v27__right-item--search-mobile'
                    xo-name='search'
                  >
                    {% render 'icon', name: 'search', icon_size: '22', color: 'rgb(var(--color-foreground))' %}
                    {% render 'icon', name: 'search', icon_size: '22', color: '#000' %}
                  </xo-modal-trigger>
                </a>
              </xo-tooltip>
              <xb-wishlist-header class='xb-wishlist__header'>
                <xo-tooltip xo-title='Wishlist' xo-placement='bottom-center'>
                  <a href='#' class='xo-header-v27__right-item xo-header-v27__right-item--heart'>
                    {% render 'icon', name: 'heart', icon_size: '22', 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-v27__right-item xo-header-v27__right-item--cart' href='{{ routes.cart_url }}'>
                    {% render 'icon', name: 'cart', icon_size: '22', color: 'rgb(var(--color-foreground))' %}
                    {% render 'icon', name: 'cart', icon_size: '22', color: '#000' %}
                    <div class='xo-header-v27__right-item-number'>
                      <xo-cart-size>{{ cart.item_count }}</xo-cart-size>
                    </div>
                  </a>
                {% else %}
                  <xo-modal-trigger
                    class='xo-header-v27__right-item xo-header-v27__right-item--cart'
                    xo-name='cart'
                  >
                    {% render 'icon', name: 'cart', icon_size: '22', color: 'rgb(var(--color-foreground))' %}
                    {% render 'icon', name: 'cart', icon_size: '22', color: '#000' %}
                    <div class='xo-header-v27__right-item-number'>
                      <xo-cart-size>{{ cart.item_count }}</xo-cart-size>
                    </div>
                  </xo-modal-trigger>
                {% endif %}
              </xo-tooltip>
            </div>
          </xo-grid>
        </xo-container>
      </div>
    </xo-sticky>
  </div>
</header>

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

{% schema %}
{
  "name": "t:sections.header_v4.name",
  "class": "section-header",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.header_v4.settings.width.label",
      "default": "1400",
      "options": [
        {
          "value": "1400",
          "label": "t:sections.header_v4.settings.width.option_1.label"
        },
        {
          "value": "unset",
          "label": "t:sections.header_v4.settings.width.option_2.label"
        }
      ]
    },
    {
      "type": "checkbox",
      "id": "country_selector",
      "default": true,
      "label": "t:sections.header_v4.settings.country_selector.label"
    },
    {
      "type": "checkbox",
      "id": "language_selector",
      "default": true,
      "label": "t:sections.header_v4.settings.language_selector.label"
    },
    {
      "type": "header",
      "content": "Header setting"
    },
    {
      "type": "checkbox",
      "id": "transparent",
      "default": false,
      "label": "t:sections.header_v4.settings.transparent.label"
    },
    {
      "type": "image_picker",
      "id": "logo",
      "label": "t:sections.header_v4.settings.logo.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "range",
      "id": "logo_width",
      "min": 50,
      "max": 250,
      "step": 5,
      "default": 100,
      "unit": "t:sections.header_v4.settings.logo_width.unit",
      "label": "t:sections.header_v4.settings.logo_width.label"
    },
    {
      "type": "image_picker",
      "id": "logo_mobile",
      "label": "t:sections.header_v4.settings.logo_mobile.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "range",
      "id": "logo_mobile-width",
      "min": 50,
      "max": 250,
      "step": 5,
      "default": 100,
      "unit": "t:sections.header_v4.settings.logo_mobile-width.unit",
      "label": "t:sections.header_v4.settings.logo_mobile-width.label"
    },
    {
      "type": "link_list",
      "id": "menu",
      "default": "main-menu",
      "label": "t:sections.header_v4.settings.menu.label"
    },
    {
      "type": "select",
      "id": "menu_type",
      "options": [
        {
          "value": "default",
          "label": "t:sections.header_v4.settings.menu_type.options__1.label"
        },
        {
          "value": "drawer",
          "label": "t:sections.header_v4.settings.menu_type.options__2.label"
        }
      ],
      "default": "default",
      "label": "t:sections.header_v4.settings.menu_type.label"
    },
    {
      "type": "select",
      "id": "hamburger_type",
      "options": [
        {
          "value": "default",
          "label": "t:sections.header_v4.settings.hamburger_type.options__1.label"
        },
        {
          "value": "drawer",
          "label": "t:sections.header_v4.settings.hamburger_type.options__2.label"
        },
        {
          "value": "horizontal",
          "label": "t:sections.header_v4.settings.hamburger_type.options__3.label"
        }
      ],
      "default": "default",
      "label": "t:sections.header_v4.settings.hamburger_type.label"
    },
    {
      "type": "select",
      "id": "sticky_header_type",
      "options": [
        {
          "value": "down",
          "label": "t:sections.header_v4.settings.sticky_header_type.options_1.label"
        },
        {
          "value": "up",
          "label": "t:sections.header_v4.settings.sticky_header_type.options_2.label"
        },
        {
          "value": "none",
          "label": "t:sections.header_v4.settings.sticky_header_type.options_3.label"
        }
      ],
      "default": "down",
      "label": "t:sections.header_v4.settings.sticky_header_type.label"
    },
    {
      "type": "select",
      "id": "event_type",
      "options": [
        {
          "value": "hover",
          "label": "t:sections.header_v4.settings.event_type.options_1.label"
        },
        {
          "value": "click",
          "label": "t:sections.header_v4.settings.event_type.options_2.label"
        }
      ],
      "default": "hover",
      "label": "t:sections.header_v4.settings.event_type.label"
    },
    {
      "type": "color",
      "id": "background_menu",
      "label": "t:sections.header_v4.settings.background_menu.label"
    },
    {
      "type": "color",
      "id": "color_text",
      "label": "t:sections.header_v4.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 %}
