Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% if section.settings.message %}
- <style>
- div#PageContainer { padding-top: 45px; }
- .site-header { top: 45px; }
- .notification-bar {
- top: 0;
- z-index:110;
- background-color: {{ section.settings.color_bg }};
- }
- .notification-bar__message {
- color: {{ section.settings.color_text }};
- }
- </style>
- {% else %}
- <style>
- .site-header { top: 0px; }
- </style>
- {% endif %}
- {% if section.settings.message %}
- <style>
- .notification-bar {
- background-color: {{ section.settings.color_bg }};
- }
- .notification-bar__message {
- color: {{ section.settings.color_text }};
- }
- {% if section.settings.logo != blank %}
- .site-header__logo-image {
- max-width: {{ section.settings.logo_max_width | escape }}px;
- }
- {% endif %}
- {% if section.settings.align_logo == 'left' %}
- .site-header__logo-image {
- margin: 0;
- }
- {% endif %}
- </style>
- {% endif %}
- <div data-section-id="{{ section.id }}" data-section-type="header-section">
- <nav class="mobile-nav-wrapper medium-up--hide" role="navigation">
- <ul id="MobileNav" class="mobile-nav">
- {% for link in linklists[section.settings.main_linklist].links %}
- {%- assign child_list_handle = link.title | handleize -%}
- <li class="mobile-nav__item{% unless forloop.last %} border-bottom{% endunless %}">
- {% if linklists[child_list_handle].links != blank %}
- <button type="button" class="btn--link js-toggle-submenu mobile-nav__link" data-target="{{ child_list_handle }}" data-level="1">
- {{ link.title }}
- <div class="mobile-nav__icon">
- {% include 'icon-chevron-right' %}
- <span class="icon__fallback-text">{{ 'layout.navigation.expand' | t }}</span>
- </div>
- </button>
- <ul class="mobile-nav__dropdown" data-parent="{{ child_list_handle }}" data-level="2">
- <li class="mobile-nav__item border-bottom">
- <div class="mobile-nav__table">
- <div class="mobile-nav__table-cell mobile-nav__return">
- <button class="btn--link js-toggle-submenu mobile-nav__return-btn" type="button">
- {% include 'icon-chevron-left' %}
- <span class="icon__fallback-text">{{ 'layout.navigation.collapse' | t }}</span>
- </button>
- </div>
- <a href="{{ link.url }}" class="mobile-nav__sublist-link mobile-nav__sublist-header">
- {{ link.title }}
- </a>
- </div>
- </li>
- {% for childlink in linklists[child_list_handle].links %}
- {% assign grand_child_list_handle = childlink.title | handle %}
- <li class="mobile-nav__item{% unless forloop.last %} border-bottom{% endunless %}">
- {% if linklists[grand_child_list_handle].links != blank %}
- <button type="button" class="btn--link js-toggle-submenu mobile-nav__link mobile-nav__sublist-link" data-target="{{ grand_child_list_handle }}">
- {{ childlink.title }}
- <div class="mobile-nav__icon">
- {% include 'icon-chevron-right' %}
- <span class="icon__fallback-text">{{ 'layout.navigation.expand' | t }}</span>
- </div>
- </button>
- <ul class="mobile-nav__dropdown" data-parent="{{ grand_child_list_handle }}" data-level="3">
- <li class="mobile-nav__item border-bottom">
- <div class="mobile-nav__table">
- <div class="mobile-nav__table-cell mobile-nav__return">
- <button type="button" class="btn--link js-toggle-submenu mobile-nav__return-btn" data-target="{{ child_list_handle }}">
- {% include 'icon-chevron-left' %}
- <span class="icon__fallback-text">{{ 'layout.navigation.collapse' | t }}</span>
- </button>
- </div>
- <a href="{{ childlink.url }}" class="mobile-nav__sublist-link mobile-nav__sublist-header">
- {{ childlink.title }}
- </a>
- </div>
- </li>
- {% for grandchildlink in linklists[grand_child_list_handle].links %}
- <li class="mobile-nav__item{% unless forloop.last %} border-bottom{% endunless %}">
- <a href="{{ grandchildlink.url }}" class="mobile-nav__sublist-link">
- {{ grandchildlink.title | escape }}
- </a>
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <a href="{{ childlink.url }}" class="mobile-nav__sublist-link">
- {{ childlink.title | escape }}
- </a>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <a href="{{ link.url }}" class="mobile-nav__link">
- {{ link.title }}
- </a>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- </nav>
- {% if section.settings.message %}
- {% if section.settings.home_page_only == false or template.name == 'index' %}
- <style>
- .announcement-bar {
- background-color: {{ section.settings.color_bg }};
- }
- .announcement-bar--link:hover {
- {% assign brightness = section.settings.color_bg | color_brightness %}
- {% if brightness <= 192 %}
- {% assign lightenAmount = 255 | minus: brightness | divided_by: 255 | times: 16 %}
- background-color: {{ section.settings.color_bg | color_lighten: lightenAmount }};
- {% else %}
- {% assign darkenAmount = 255 | divided_by: brightness | times: 8 %}
- background-color: {{ section.settings.color_bg | color_darken: darkenAmount }};
- {% endif %}
- }
- .announcement-bar__message {
- color: {{ section.settings.color_text }};
- }
- </style>
- {% if section.settings.message_link == blank %}
- <div class="announcement-bar">
- {% else %}
- <a href="{{ section.settings.message_link }}" class="announcement-bar announcement-bar--link">
- {% endif %}
- <p class="announcement-bar__message">{{ section.settings.message_text | escape }}</p>
- {% if section.settings.message_link == blank %}
- </div>
- {% else %}
- </a>
- {% endif %}
- {% endif %}
- {% endif %}
- <header class="site-header{% if section.settings.align_logo == 'left' %} border-bottom logo--left{% else %} logo--center{% endif %}" role="banner">
- <div class="grid grid--no-gutters grid--table">
- {% if section.settings.align_logo == 'center' %}
- <div class="grid__item small--hide medium-up--one-third">
- <div class="site-header__search">
- {% include 'search-form' %}
- </div>
- </div>
- {% endif %}
- {% if section.settings.align_logo == 'center' %}
- {%- assign logo_classes = 'medium-up--one-third logo-align--center' -%}
- {% else %}
- {%- assign logo_classes = 'medium-up--one-quarter logo-align--left' -%}
- {% endif %}
- <div class="grid__item small--one-half {{ logo_classes }}">
- {% comment %}
- Use the uploaded logo from theme settings if enabled.
- Site name gets precedence with H1 tag on homepage, div on other pages.
- {% endcomment %}
- {% if template.name == 'index' %}
- <h1 class="h2 site-header__logo" itemscope itemtype="http://schema.org/Organization">
- {% else %}
- <div class="h2 site-header__logo" itemscope itemtype="http://schema.org/Organization">
- {% endif %}
- {% if section.settings.logo %}
- {%- assign img_url = section.settings.logo | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
- <a href="/" itemprop="url" class="site-header__logo-image{% if section.settings.align_logo == 'center' %} site-header__logo-image--centered{% endif %}">
- {% capture logo_alt %}{{ section.settings.logo.alt | default: shop.name }}{% endcapture %}
- <img class="lazyload js"
- src="{{ section.settings.logo | img_url: '300x300' }}"
- data-src="{{ img_url }}"
- data-widths="[180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048]"
- data-aspectratio="{{ section.settings.logo.aspect_ratio }}"
- data-sizes="auto"
- alt="{{ logo_alt | escape }}"
- style="max-width: {{ section.settings.logo_max_width }}px">
- <noscript>
- {% capture image_size %}{{ section.settings.logo_max_width | escape }}x{% endcapture %}
- <img src="{{ section.settings.logo | img_url: image_size }}"
- srcset="{{ section.settings.logo | img_url: image_size }} 1x, {{ section.settings.logo | img_url: image_size, scale: 2 }} 2x"
- alt="{{ section.settings.logo.alt | default: shop.name }}"
- itemprop="logo"
- style="max-width: {{ section.settings.logo_max_width }}px;">
- </noscript>
- </a>
- {% else %}
- <a class="site-header__logo-link" href="/" itemprop="url">{{ shop.name }}</a>
- {% endif %}
- {% if template.name == 'index' %}
- </h1>
- {% else %}
- </div>
- {% endif %}
- </div>
- {% if section.settings.align_logo == 'left' %}
- <nav class="grid__item medium-up--one-half small--hide" id="AccessibleNav" role="navigation">
- {% include 'site-nav' %}
- </nav>
- {% endif %}
- <div class="grid__item small--one-half {% if section.settings.align_logo == 'left' %}medium-up--one-quarter{% else %}medium-up--one-third{% endif %} text-right site-header__icons{% if shop.customer_accounts_enabled %} site-header__icons--plus{% endif %}">
- <div class="site-header__icons-wrapper">
- {% if section.settings.align_logo == 'left' %}
- <div class="site-header__search small--hide">
- {% include 'search-form' %}
- </div>
- {% endif %}
- <button type="button" class="btn--link site-header__search-toggle js-drawer-open-top medium-up--hide">
- {% include 'icon-search' %}
- <span class="icon__fallback-text">{{ 'layout.navigation.search' | t }}</span>
- </button>
- {% if shop.customer_accounts_enabled %}
- {% if customer %}
- <a href="/account" class="site-header__account">
- {% include 'icon-login' %}
- <span class="icon__fallback-text">{{ 'layout.customer.account' | t }}</span>
- </a>
- {% else %}
- <a href="/account/login" class="site-header__account">
- {% include 'icon-login' %}
- <span class="icon__fallback-text">{{ 'layout.customer.log_in' | t }}</span>
- </a>
- {% endif %}
- {% endif %}
- <a href="/cart" class="site-header__cart">
- {% include 'icon-cart' %}
- <span class="visually-hidden">{{ 'layout.cart.title' | t }}</span>
- <span class="icon__fallback-text">{{ 'layout.cart.title' | t }}</span>
- {% if cart.item_count > 0 %}
- <div id="CartCount" class="site-header__cart-count">
- <span>{{ cart.item_count }}</span>
- <span class="icon__fallback-text medium-up--hide">{{ 'layout.cart.items_count' | t: count: cart.item_count }}</span>
- </div>
- {% endif %}
- </a>
- {% unless linklists[section.settings.main_linklist] == blank %}
- <button type="button" class="btn--link site-header__menu js-mobile-nav-toggle mobile-nav--open">
- {% include 'icon-hamburger' %}
- {% include 'icon-close' %}
- <span class="icon__fallback-text">{{ 'layout.navigation.toggle' | t }}</span>
- </button>
- {% endunless %}
- </div>
- </div>
- </div>
- </header>
- {% if section.settings.align_logo == 'center' %}
- <nav class="small--hide border-bottom" id="AccessibleNav" role="navigation">
- {% include 'site-nav', nav_alignment: 'site-nav--centered' %}
- </nav>
- {% endif %}
- </div>
- {% schema %}
- {
- "name": "Header",
- "settings": [
- {
- "type": "radio",
- "id": "align_logo",
- "label": "Logo alignment",
- "default": "left",
- "options": [
- {"value": "left", "label": "Left"},
- {"value": "center", "label": "Centered"}
- ]
- },
- {
- "type": "image_picker",
- "id": "logo",
- "label": "Logo image"
- },
- {
- "type": "text",
- "id": "logo_max_width",
- "label": "Custom logo width (in pixels)",
- "default": "100"
- },
- {
- "type": "link_list",
- "id": "main_linklist",
- "label": "Menu",
- "default": "main-menu"
- },
- {
- "type": "header",
- "content": "Announcement bar"
- },
- {
- "type": "checkbox",
- "id": "message",
- "label": "Show announcement",
- "default": false
- },
- {
- "type": "checkbox",
- "id": "home_page_only",
- "label": "Home page only",
- "default": true
- },
- {
- "type": "text",
- "id": "message_text",
- "label": "Announcement text",
- "default": "Announce something here"
- },
- {
- "type": "url",
- "id": "message_link",
- "label": "Announcement link",
- "info": "Optional"
- },
- {
- "type": "color",
- "id": "color_bg",
- "label": "Bar",
- "default": "#7796a8"
- },
- {
- "type": "color",
- "id": "color_text",
- "label": "Text",
- "default": "#fff"
- }
- ]
- }
- {% endschema %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement