Files
season/sections/header.liquid
T
2026-10-02 15:46:21 -06:00

821 lines
25 KiB
Plaintext

{% liquid
if customer
assign account_url = routes.account_url
else
assign account_url = routes.account_login_url
endif
if section.settings.promo_text != blank
assign promo_text = section.settings.promo_text
else
assign promo_text = 'header.promo' | t
endif
%}
<header
class="header full-width relative z-40 bg-white font-sans text-black"
data-header
data-menu-close="{{ 'header.menu_close' | t | escape }}"
>
<div class="header__shell relative grid grid-cols-[auto_minmax(0,699px)_1fr_auto_auto] items-center px-[100px] pt-[15px] xxl:px-10">
<button
type="button"
class="header__toggle col-start-1 row-start-1 hidden size-[30px] cursor-pointer appearance-none items-center justify-center border-0 bg-transparent p-0"
data-menu-toggle
aria-expanded="false"
aria-controls="header-menu"
aria-label="{{ 'header.menu_open' | t }}"
>
<span class="header__icon header__icon--menu" aria-hidden="true">
{{ 'icon-menu.svg' | inline_asset_content }}
</span>
<span class="header__icon header__icon--close" aria-hidden="true"></span>
</button>
<a
class="header__logo col-start-1 row-start-1 mr-[50px] block w-[223px] shrink-0 no-underline xxl:mr-8"
href="{{ routes.root_url }}"
>
{% if section.settings.logo != blank %}
{{
section.settings.logo
| image_url: width: 480
| image_tag: alt: shop.name, class: 'header__logo-image h-auto w-[223px]', widths: '150, 223, 446'
}}
{% else %}
<span class="header__logo-mark" aria-hidden="true">
{{ 'logo-seasons.svg' | inline_asset_content }}
</span>
<span class="sr-only">{{ shop.name }}</span>
{% endif %}
</a>
<form
class="header__search col-start-2 row-start-1 mr-[50px] flex h-[55px] w-full min-w-0 max-w-[699px] items-center rounded-full bg-brand-cloud p-[5px] xxl:mr-8"
action="{{ routes.search_url }}"
method="get"
role="search"
data-search
>
<button
type="submit"
class="header__search-button grid size-10 shrink-0 cursor-pointer appearance-none place-items-center rounded-full border-0 bg-brand-mint p-0"
aria-label="{{ 'header.search_label' | t }}"
>
<span class="header__icon header__icon--search" aria-hidden="true">
{{ 'icon-search.svg' | inline_asset_content }}
</span>
</button>
<label class="sr-only" for="header-search">{{ 'header.search_label' | t }}</label>
<input
id="header-search"
class="header__search-input min-w-0 flex-1 border-0 bg-transparent px-5 text-[16px] font-light leading-none text-black outline-none placeholder:font-light placeholder:text-brand-placeholder"
type="search"
name="q"
placeholder="{{ 'header.search_placeholder' | t }}"
{% if template.name == 'search' %}
value="{{ search.terms | escape }}"
{% endif %}
data-search-input
>
</form>
<button
type="button"
class="header__cart relative col-start-5 row-start-1 flex size-[45px] cursor-pointer appearance-none items-center justify-center border-0 bg-transparent p-0"
data-cart-open
data-cart-count-label="{{ 'header.cart_count' | t: count: '__COUNT__' | escape }}"
aria-controls="cart-drawer"
aria-expanded="false"
aria-haspopup="dialog"
aria-label="{{ 'header.cart_count' | t: count: cart.item_count }}"
>
<span class="header__icon header__icon--bag" aria-hidden="true">
{{ 'icon-bag.svg' | inline_asset_content }}
</span>
{% if cart.item_count > 0 %}
<span class="absolute right-0 top-0 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand-mint px-[3px] text-[10px] font-medium leading-none text-black" data-cart-count>
{{ cart.item_count }}
</span>
{% endif %}
</button>
<nav
id="header-menu"
class="header__nav pointer-events-none col-span-5 col-start-1 row-span-2 row-start-1 grid grid-cols-subgrid grid-rows-subgrid self-stretch"
data-menu
>
<div class="header__utility pointer-events-auto col-start-4 row-start-1 mr-5 flex items-center gap-[50px] xxl:gap-8">
<ul class="m-0 flex list-none items-center gap-5 p-0">
{% if section.settings.utility_menu != blank and section.settings.utility_menu.links.size > 0 %}
{% for link in section.settings.utility_menu.links %}
<li>
<a
class="inline-flex items-center px-5 py-1 text-[14px] font-normal leading-none text-black no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-black"
href="{{ link.url }}"
>
{{ link.title }}
</a>
</li>
{% endfor %}
{% else %}
<li>
<a
class="inline-flex items-center px-5 py-1 text-[14px] font-normal leading-none text-black no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-black"
href="{{ routes.root_url }}"
>
{{ 'header.links.glow_army' | t }}
</a>
</li>
<li>
<a
class="inline-flex items-center px-5 py-1 text-[14px] font-normal leading-none text-black no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-black"
href="{{ routes.root_url }}"
>
{{ 'header.links.experts' | t }}
</a>
</li>
{% endif %}
</ul>
<a
class="header__account flex size-[45px] items-center justify-center no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-black"
href="{{ account_url }}"
>
<span class="header__icon header__icon--user" aria-hidden="true">
{{ 'icon-user.svg' | inline_asset_content }}
</span>
<span class="header__account-label text-[14px] font-normal leading-none text-black">
{{ 'header.account' | t }}
</span>
</a>
</div>
<div class="header__menu pointer-events-auto col-span-5 row-start-2 mt-[15px] flex items-center justify-center gap-[50px] py-2 xxl:gap-8">
<ul class="header__links m-0 flex list-none items-center gap-10 p-0 xxl:gap-6">
{% if section.settings.menu != blank and section.settings.menu.links.size > 0 %}
{% for link in section.settings.menu.links %}
{% render 'header-menu-item', title: link.title, url: link.url, child_links: link.links %}
{% endfor %}
{% else %}
{% liquid
assign nav_categories = 'header.links.categories' | t
assign nav_routine = 'header.links.routine' | t
assign nav_skin_type = 'header.links.skin_type' | t
assign nav_concern = 'header.links.concern' | t
assign label_all = 'header.dropdowns.all_products' | t
assign label_blockers = 'header.dropdowns.blockers' | t
assign label_moisturizers = 'header.dropdowns.moisturizers' | t
assign label_cleansers = 'header.dropdowns.cleansers' | t
assign label_masks = 'header.dropdowns.masks' | t
assign label_serums = 'header.dropdowns.serums' | t
assign label_clean = 'header.dropdowns.clean' | t
assign label_treat = 'header.dropdowns.treat' | t
assign label_hydrate = 'header.dropdowns.hydrate' | t
assign label_protect = 'header.dropdowns.protect' | t
assign label_kits = 'header.dropdowns.kits' | t
assign label_combination = 'header.dropdowns.combination' | t
assign label_oily = 'header.dropdowns.oily' | t
assign label_dry = 'header.dropdowns.dry' | t
assign label_sun = 'header.dropdowns.sun_protection' | t
assign label_oil = 'header.dropdowns.oil_control' | t
assign label_acne = 'header.dropdowns.acne' | t
assign label_hydration = 'header.dropdowns.hydration' | t
assign label_aging = 'header.dropdowns.anti_aging' | t
assign label_spots = 'header.dropdowns.spots' | t
assign categories_menu = label_all | append: '::' | append: routes.all_products_collection_url | append: '|' | append: label_blockers | append: '::/collections/bloqueadores|' | append: label_moisturizers | append: '::/collections/hidratantes|' | append: label_cleansers | append: '::/collections/limpiadores|' | append: label_masks | append: '::/collections/mascarillas|' | append: label_serums | append: '::/collections/serums'
assign routine_menu = label_clean | append: '::/collections/limpia|' | append: label_treat | append: '::/collections/trata|' | append: label_hydrate | append: '::/collections/hidrata|' | append: label_protect | append: '::/collections/protege|' | append: label_kits | append: '::/collections/kits-y-rutinas-completas'
assign skin_menu = label_combination | append: '::/collections/mixta-grasa|' | append: label_oily | append: '::/collections/grasa|' | append: label_dry | append: '::/collections/seca'
assign concern_menu = label_sun | append: '::/collections/proteccion-solar|' | append: label_oil | append: '::/collections/control-grasa|' | append: label_acne | append: '::/collections/acne|' | append: label_hydration | append: '::/collections/hidratacion|' | append: label_aging | append: '::/collections/antiedad|' | append: label_spots | append: '::/collections/manchas'
%}
{% render 'header-menu-item', title: nav_categories, url: routes.all_products_collection_url, child_menu: categories_menu %}
{% render 'header-menu-item', title: nav_routine, url: routes.collections_url, child_menu: routine_menu %}
{% render 'header-menu-item', title: nav_skin_type, url: routes.collections_url, child_menu: skin_menu %}
{% render 'header-menu-item', title: nav_concern, url: routes.collections_url, child_menu: concern_menu %}
{% endif %}
</ul>
<ul class="header__pills m-0 flex list-none items-center gap-[15px] p-0">
{% if section.settings.pills_menu != blank and section.settings.pills_menu.links.size > 0 %}
{% for link in section.settings.pills_menu.links %}
<li>
<a
class="inline-flex items-center justify-center rounded-full border border-solid border-black px-5 py-1 text-[14px] font-normal leading-none text-black no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-black"
href="{{ link.url }}"
>
{{ link.title }}
</a>
</li>
{% endfor %}
{% else %}
<li>
<a class="inline-flex items-center justify-center rounded-full border border-solid border-black px-5 py-1 text-[14px] font-normal leading-none text-black no-underline" href="{{ routes.collections_url }}">
{{ 'header.links.sunscreen' | t }}
</a>
</li>
<li>
<a class="inline-flex items-center justify-center rounded-full border border-solid border-black px-5 py-1 text-[14px] font-normal leading-none text-black no-underline" href="{{ routes.collections_url }}">
{{ 'header.links.favorites' | t }}
</a>
</li>
<li>
<a class="inline-flex items-center justify-center rounded-full border border-solid border-black px-5 py-1 text-[14px] font-normal leading-none text-black no-underline" href="{{ routes.collections_url }}">
{{ 'header.links.kits' | t }}
</a>
</li>
<li>
<a class="inline-flex items-center justify-center rounded-full border border-solid border-black px-5 py-1 text-[14px] font-normal leading-none text-black no-underline" href="{{ routes.collections_url }}">
{{ 'header.links.moisturizers' | t }}
</a>
</li>
{% endif %}
</ul>
</div>
</nav>
</div>
{% if promo_text != blank %}
<div class="header__promo flex h-[50px] items-center justify-center bg-brand-mint px-4 text-center">
{% if section.settings.promo_link != blank %}
<a class="text-[20px] font-bold uppercase leading-none text-black no-underline xl:text-[14px]" href="{{ section.settings.promo_link }}">
{{ promo_text }}
</a>
{% else %}
<p class="m-0 text-[20px] font-bold uppercase leading-none xl:text-[14px]">
{{ promo_text }}
</p>
{% endif %}
</div>
{% endif %}
<button
type="button"
class="header__backdrop fixed inset-0 z-30 hidden cursor-pointer border-0 bg-black/40 p-0"
data-menu-backdrop
aria-label="{{ 'header.menu_close' | t }}"
tabindex="-1"
></button>
</header>
{% stylesheet %}
.header__logo-mark svg,
.header__logo-image {
display: block;
width: 223px;
height: auto;
}
.header__icon {
display: flex;
align-items: center;
justify-content: center;
}
.header__icon svg {
display: block;
}
.header__icon--menu svg {
width: 30px;
height: 30px;
}
.header__icon--search svg {
width: 22px;
height: 22px;
}
.header__icon--user svg {
width: 22px;
height: 22px;
}
.header__icon--bag svg {
width: 30px;
height: 30px;
}
.header__shell {
z-index: 2;
}
.header__promo {
position: relative;
z-index: 1;
}
.header__caret-button {
width: 10px;
height: 10px;
}
.header__submenu {
min-width: 280px;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}
.header__icon--caret {
display: flex;
transform: rotate(180deg);
transition: transform 0.2s ease;
}
.header__icon--caret svg {
width: 10px;
height: 10px;
}
.header__item.is-open .header__icon--caret {
transform: rotate(0deg);
}
.header__icon--close {
display: none;
position: relative;
width: 18px;
height: 18px;
}
.header__icon--close::before,
.header__icon--close::after {
content: '';
position: absolute;
left: 0;
top: 8px;
width: 18px;
height: 1.4px;
background: #000;
}
.header__icon--close::before {
transform: rotate(45deg);
}
.header__icon--close::after {
transform: rotate(-45deg);
}
.header__account-label {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.header button,
.header input {
font: inherit;
color: inherit;
}
.header input[type='search']::-webkit-search-decoration,
.header input[type='search']::-webkit-search-cancel-button {
appearance: none;
}
@media (min-width: 1120px) {
.header__submenu::before {
content: '';
position: absolute;
top: -16px;
left: 0;
width: 100%;
height: 16px;
}
.header__submenu {
margin-top: 8px;
}
.header__item:hover > .header__submenu,
.header__item:focus-within > .header__submenu,
.header__item.is-open > .header__submenu {
display: block;
}
}
@media (max-width: 1119px) {
.header__shell {
position: relative;
display: flex;
align-items: center;
height: 55px;
padding: 0 10px;
}
.header__toggle {
display: grid;
position: relative;
z-index: 50;
order: 1;
flex: 0 0 30px;
}
.header.is-menu-open .header__icon--menu {
display: none;
}
.header.is-menu-open .header__icon--close {
display: block;
}
.header__logo {
position: absolute;
top: 0;
left: 50%;
z-index: 1;
display: flex;
align-items: center;
width: 150px;
height: 55px;
margin: 0;
transform: translateX(-50%);
}
.header__logo-mark svg,
.header__logo-image {
width: 150px;
}
.header__search {
position: absolute;
top: 12px;
right: 50px;
z-index: 2;
width: 30px;
height: 30px;
max-width: none;
margin: 0;
padding: 0;
overflow: hidden;
background: transparent;
}
.header__search-button {
width: 30px;
height: 30px;
background-color: #9dd6c7;
border-radius: 999px;
}
.header__icon--search svg {
width: 14px;
height: 14px;
}
.header__search-input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.header__search.is-open {
top: 6px;
right: 50px;
left: 10px;
z-index: 3;
width: auto;
height: 44px;
overflow: visible;
padding: 5px;
background: #f8f8f8;
}
.header__search.is-open .header__search-input {
position: static;
width: auto;
height: auto;
margin: 0;
padding: 0 12px;
overflow: visible;
clip: auto;
white-space: normal;
}
.header__cart {
position: absolute;
top: 12px;
right: 10px;
z-index: 2;
flex: 0 0 30px;
width: 30px;
height: 30px;
}
.header__icon--bag svg {
width: 18px;
height: 18px;
}
.header__nav {
position: absolute;
top: 100%;
right: 0;
left: 0;
z-index: 40;
display: none;
pointer-events: auto;
max-height: calc(100dvh - 90px);
overflow: auto;
background: #fff;
padding: 8px 16px 28px;
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}
.header__nav.is-open {
display: flex;
flex-direction: column;
gap: 20px;
}
.header__menu {
order: 1;
flex-direction: column;
align-items: stretch;
gap: 20px;
margin-top: 0;
padding-top: 4px;
}
.header__links {
flex-direction: column;
align-items: stretch;
gap: 0;
}
.header__links .header__item {
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
padding: 14px 0;
border-bottom: 1px solid #ececec;
}
.header__caret-button {
width: 32px;
height: 32px;
}
.header__nav .header__submenu {
position: static;
top: auto;
left: auto;
z-index: auto;
flex: 0 0 100%;
min-width: 0;
width: 100%;
margin: 8px 0 0;
padding: 4px 0 8px;
background: transparent;
border-radius: 0;
box-shadow: none;
}
.header__nav .header__item.is-open > .header__submenu {
display: flex;
flex-direction: column;
gap: 12px;
}
.header__pills {
flex-wrap: wrap;
gap: 10px;
}
.header__utility {
order: 2;
flex-direction: column;
align-items: flex-start;
gap: 8px;
margin-right: 0;
}
.header__utility > ul {
flex-direction: column;
align-items: flex-start;
gap: 4px;
}
.header__account {
width: auto;
height: auto;
justify-content: flex-start;
gap: 10px;
padding: 10px 20px 10px 0;
}
.header__account-label {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
white-space: normal;
}
.header__promo {
height: 30px;
}
.header__promo a,
.header__promo p {
font-size: 14px;
}
.header.is-menu-open .header__shell {
z-index: 3;
}
.header.is-menu-open .header__backdrop {
z-index: 1;
display: block;
}
}
@media (max-width: 380px) {
.header__logo,
.header__logo-mark svg,
.header__logo-image {
width: 128px;
}
}
{% endstylesheet %}
{% javascript %}
(() => {
if (window.__seasonHeader) return;
window.__seasonHeader = true;
const mobileQuery = window.matchMedia('(max-width: 1119px)');
const closeMenu = (header) => {
const menu = header.querySelector('[data-menu]');
const toggle = header.querySelector('[data-menu-toggle]');
menu?.classList.remove('is-open');
header.classList.remove('is-menu-open');
toggle?.setAttribute('aria-expanded', 'false');
if (toggle) toggle.setAttribute('aria-label', toggle.dataset.labelOpen || '');
document.documentElement.classList.remove('overflow-hidden');
};
const closeSearch = (header) => {
header.querySelector('[data-search]')?.classList.remove('is-open');
};
const bind = (header) => {
if (header.dataset.ready === 'true') return;
header.dataset.ready = 'true';
const toggle = header.querySelector('[data-menu-toggle]');
const menu = header.querySelector('[data-menu]');
const searchForm = header.querySelector('[data-search]');
const searchInput = header.querySelector('[data-search-input]');
const backdrop = header.querySelector('[data-menu-backdrop]');
if (toggle) {
toggle.dataset.labelOpen = toggle.getAttribute('aria-label') || '';
toggle.dataset.labelClose = header.dataset.menuClose || toggle.dataset.labelOpen;
}
toggle?.addEventListener('click', () => {
const willOpen = !menu.classList.contains('is-open');
closeSearch(header);
menu.classList.toggle('is-open', willOpen);
header.classList.toggle('is-menu-open', willOpen);
toggle.setAttribute('aria-expanded', willOpen ? 'true' : 'false');
toggle.setAttribute('aria-label', willOpen ? toggle.dataset.labelClose : toggle.dataset.labelOpen);
document.documentElement.classList.toggle('overflow-hidden', willOpen);
});
backdrop?.addEventListener('click', () => closeMenu(header));
searchForm?.addEventListener('submit', (event) => {
if (!mobileQuery.matches || searchForm.classList.contains('is-open')) return;
event.preventDefault();
closeMenu(header);
searchForm.classList.add('is-open');
searchInput?.focus();
});
menu?.addEventListener('click', (event) => {
const submenuToggle = event.target.closest('[data-submenu-toggle]');
const toggleSubmenu = (submenuToggle) => {
const item = submenuToggle.closest('[data-menu-item]');
const expanded = submenuToggle.getAttribute('aria-expanded') === 'true';
item.parentElement.querySelectorAll('[data-menu-item].is-open').forEach((sibling) => {
if (sibling === item) return;
sibling.classList.remove('is-open');
sibling.querySelector('[data-submenu-toggle]')?.setAttribute('aria-expanded', 'false');
});
item.classList.toggle('is-open', !expanded);
submenuToggle.setAttribute('aria-expanded', expanded ? 'false' : 'true');
};
if (submenuToggle) {
event.preventDefault();
toggleSubmenu(submenuToggle);
return;
}
const parentLink = event.target.closest('[data-menu-item] > a');
if (mobileQuery.matches && parentLink) {
const submenuToggleForLink = parentLink.parentElement.querySelector('[data-submenu-toggle]');
if (submenuToggleForLink) {
event.preventDefault();
toggleSubmenu(submenuToggleForLink);
return;
}
}
if (mobileQuery.matches && event.target.closest('a')) closeMenu(header);
});
};
document.querySelectorAll('[data-header]').forEach((header) => {
header.dataset.menuClose = header.getAttribute('data-menu-close') || '';
bind(header);
});
document.addEventListener('click', (event) => {
document.querySelectorAll('[data-header]').forEach((header) => {
if (header.contains(event.target)) return;
closeMenu(header);
closeSearch(header);
});
});
document.addEventListener('keydown', (event) => {
if (event.key !== 'Escape') return;
document.querySelectorAll('[data-header]').forEach((header) => {
closeMenu(header);
closeSearch(header);
});
});
mobileQuery.addEventListener('change', (event) => {
if (event.matches) return;
document.querySelectorAll('[data-header]').forEach((header) => {
closeMenu(header);
closeSearch(header);
});
});
document.addEventListener('shopify:section:load', (event) => {
const header = event.target.querySelector('[data-header]');
if (header) bind(header);
});
})();
{% endjavascript %}
{% schema %}
{
"name": "t:general.header",
"settings": [
{
"type": "image_picker",
"id": "logo",
"label": "t:header.logo"
},
{
"type": "link_list",
"id": "menu",
"label": "t:header.main_menu",
"info": "t:header.main_menu_info"
},
{
"type": "link_list",
"id": "pills_menu",
"label": "t:header.pills_menu"
},
{
"type": "link_list",
"id": "utility_menu",
"label": "t:header.utility_menu"
},
{
"type": "text",
"id": "promo_text",
"label": "t:header.promo_text",
"default": "Cambia tu piel ¡hoy!"
},
{
"type": "url",
"id": "promo_link",
"label": "t:header.promo_link"
}
]
}
{% endschema %}