This repository has been archived on 2026-06-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
colors-patch/global/templates/header/template.html
T

793 lines
21 KiB
HTML

<header class="site-header">
<!-- Top bar (bg-primary) -->
<div class="top-bar text-sm">
<div class="container top-bar-inner">
<div class="top-bar-left">{{{customContentHeader}}}</div>
<nav class="top-bar-right">
{{#each menu.top}}
<a href="{{this.href}}">{{this.text}}</a>
{{/each}}
</nav>
</div>
</div>
<!-- Main Header -->
<div class="container">
<div class="main-header">
<!-- Logo -->
<a href="/" class="logo">
{{#if logo.src}}
<img src="{{logo.src}}" alt="{{logo.alt}}" class="logo-img" />
{{else}}
<div class="logo-icon text-lg font-bold">C</div>
<span class="logo-text text-xl font-bold tracking-tight">colors</span>
{{/if}}
</a>
<!-- Desktop Navigation -->
<nav class="desktop-nav">
{{#each menu.main}}
<div class="nav-item text-sm font-medium uppercase tracking-wide">
<a href="{{this.href}}" class="nav-link">
{{this.text}} {{#if this.sublinks}}
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="nav-icon"
>
<path d="m6 9 6 6 6-6" />
</svg>
{{/if}}
</a>
<!-- First level dropdown -->
{{#if this.sublinks}}
<div class="dropdown">
<div class="dropdown-inner">
{{#each this.sublinks}}
<div class="dropdown-item">
<a href="{{this.href}}" class="dropdown-link text-sm">
{{this.text}} {{#if this.sublinks}}
<!-- Removed nav-icon class so it no longer accidentally flips on top-level hover -->
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
style="width: 1rem; height: 1rem"
>
<path d="m9 18 6-6-6-6" />
</svg>
{{/if}}
</a>
<!-- Second level dropdown -->
{{#if this.sublinks}}
<div class="sub-dropdown">
<div class="dropdown-inner">
{{#each this.sublinks}}
<!-- Applying dropdown-link here fixes the hover issue -->
<a href="{{this.href}}" class="dropdown-link text-sm">
{{this.text}}
</a>
{{/each}}
</div>
</div>
{{/if}}
</div>
{{/each}}
</div>
</div>
{{/if}}
</div>
{{/each}}
</nav>
<!-- Actions -->
<div class="actions">
<button id="search-toggle" class="action-btn" aria-label="Vyhledávání">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="11" cy="11" r="8" />
<path d="m21 21-4.3-4.3" />
</svg>
</button>
<a href="#" class="action-btn desktop-user">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
</svg>
</a>
<a href="{{basket.link}}" class="action-btn cart-wrapper">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="8" cy="21" r="1" />
<circle cx="19" cy="21" r="1" />
<path
d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"
/>
</svg>
<span class="cart-badge text-xs font-bold">{{basket.itemCount}}</span>
</a>
<button
id="mobile-menu-toggle"
class="action-btn mobile-menu-btn"
aria-label="Menu"
>
<svg
id="menu-icon-open"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="4" x2="20" y1="12" y2="12" />
<line x1="4" x2="20" y1="6" y2="6" />
<line x1="4" x2="20" y1="18" y2="18" />
</svg>
<svg
id="menu-icon-close"
class="hidden"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
</div>
<!-- Search Bar (Slide down) -->
<div id="search-bar" class="search-container hidden">
<div class="search-input-wrapper">
<input
type="search"
placeholder="Hledat produkty..."
class="search-input"
/>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="search-icon"
>
<circle cx="11" cy="11" r="8" />
<path d="m21 21-4.3-4.3" />
</svg>
</div>
</div>
</div>
<!-- Mobile Menu (Slide down) -->
<div id="mobile-menu" class="mobile-menu hidden">
<nav class="container mobile-nav-inner">
{{#each menu.main}}
<div class="mobile-item-wrap">
<div class="mobile-item-header">
<a href="{{this.href}}" class="mobile-link font-medium">
{{this.text}}
</a>
{{#if this.sublinks}}
<button class="mobile-toggle js-submenu-toggle">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m6 9 6 6 6-6" />
</svg>
</button>
{{/if}}
</div>
{{#if this.sublinks}}
<div class="mobile-sub-menu hidden">
{{#each this.sublinks}}
<div class="mobile-item-wrap">
<div class="mobile-item-header">
<a href="{{this.href}}" class="mobile-link text-sm">
{{this.text}}
</a>
</div>
{{#if this.sublinks}}
<!-- Auto-expand 3rd level on mobile to match React setup structure -->
<div
class="mobile-sub-menu"
style="
display: block;
border-color: transparent;
margin-top: 0;
padding-top: 0;
"
>
{{#each this.sublinks}}
<div class="mobile-item-header">
<a
href="{{this.href}}"
class="mobile-link text-sm"
style="color: var(--muted-foreground)"
>
{{this.text}}
</a>
</div>
{{/each}}
</div>
{{/if}}
</div>
{{/each}}
</div>
{{/if}}
</div>
{{/each}}
<!-- Top bar data fallback on mobile -->
<div class="mobile-contact">{{{customContentHeader}}}</div>
</nav>
</div>
<style>
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap");
:root {
/* Exact provided variables (Light Mode Only) */
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--destructive-foreground: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
/* Layout Variables */
--font-sans:
"Geist", "Geist Fallback", ui-sans-serif, system-ui, sans-serif;
--max-w-7xl: 80rem; /* 1280px */
--h-16: 4rem; /* 64px */
--h-20: 5rem; /* 80px */
--w-10: 2.5rem; /* 40px */
--h-10: 2.5rem; /* 40px */
}
/* Reset & Base Setup */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: var(--background);
color: var(--foreground);
}
.site-header {
font-family: var(--font-sans);
position: sticky;
top: 0;
z-index: 50;
background-color: var(--card);
border-bottom: 1px solid var(--border);
color: var(--foreground);
}
.site-header a,
.site-header button {
text-decoration: none;
color: inherit;
font-family: inherit;
}
/* Container bounds mapping exactly to max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 */
.container {
max-width: var(--max-w-7xl);
margin: 0 auto;
padding: 0 1rem;
}
@media (min-width: 640px) {
.container {
padding: 0 1.5rem;
}
}
@media (min-width: 1024px) {
.container {
padding: 0 2rem;
}
}
/* Utilities */
.text-xs {
font-size: 0.75rem;
line-height: 1rem;
}
.text-sm {
font-size: 0.875rem;
line-height: 1.25rem;
}
.text-base {
font-size: 1rem;
line-height: 1.5rem;
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
.text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
.font-medium {
font-weight: 500;
}
.font-bold {
font-weight: 700;
}
.uppercase {
text-transform: uppercase;
}
.tracking-wide {
letter-spacing: 0.025em;
}
.tracking-tight {
letter-spacing: -0.025em;
}
.hidden {
display: none !important;
}
/* ------------------ Top Bar ------------------ */
.top-bar {
background-color: var(--primary);
color: var(--primary-foreground);
padding: 0.5rem 0; /* py-2 */
}
.top-bar-inner {
display: flex;
align-items: center;
justify-content: space-between;
}
.top-bar-left,
.top-bar-right {
display: flex;
align-items: center;
gap: 1.5rem; /* gap-6 */
}
.top-bar-left a,
.top-bar-right a {
transition: opacity 0.2s;
}
.top-bar-left a:hover,
.top-bar-right a:hover {
opacity: 0.8;
}
.top-bar-left {
display: none;
}
@media (min-width: 640px) {
.top-bar-left {
display: flex;
}
}
/* ------------------ Main Header ------------------ */
.main-header {
display: flex;
align-items: center;
justify-content: space-between;
height: var(--h-16);
}
@media (min-width: 1024px) {
.main-header {
height: var(--h-20);
}
}
/* Logo */
.logo {
display: flex;
align-items: center;
gap: 0.5rem; /* gap-2 */
}
.logo-img {
height: var(--h-10);
width: auto;
}
.logo-icon {
width: var(--w-10);
height: var(--h-10);
border-radius: 9999px;
background: linear-gradient(
to bottom right,
var(--accent),
color-mix(in srgb, var(--accent) 70%, transparent)
);
display: flex;
align-items: center;
justify-content: center;
color: var(--accent-foreground);
}
.logo-text {
color: var(--foreground);
}
/* ------------------ Desktop Nav ------------------ */
.desktop-nav {
display: none;
align-items: center;
gap: 2rem; /* gap-8 */
height: 100%;
}
@media (min-width: 1024px) {
.desktop-nav {
display: flex;
}
}
.nav-item {
position: relative;
height: 100%;
display: flex;
align-items: center;
}
.nav-link {
display: flex;
align-items: center;
gap: 0.25rem; /* gap-1 */
padding: 0.5rem 0; /* py-2 */
color: var(--foreground);
transition: color 0.2s;
}
.nav-link:hover {
color: var(--accent-foreground);
}
.nav-icon {
width: 1rem;
height: 1rem; /* w-4 h-4 */
transition: transform 0.2s;
}
/* ONLY rotate the chevron inside the top-level link, not the nested ones */
.nav-item:hover > .nav-link .nav-icon {
transform: rotate(180deg);
}
/* Dropdowns */
.dropdown {
display: none;
position: absolute;
top: 100%;
left: 0;
padding-top: 0.5rem; /* pt-2 */
z-index: 50;
}
.nav-item:hover .dropdown {
display: block;
}
.dropdown-inner {
background-color: var(--card);
border: 1px solid var(--border);
border-radius: 0.5rem;
box-shadow:
0 10px 15px -3px rgba(0, 0, 0, 0.1),
0 4px 6px -4px rgba(0, 0, 0, 0.1);
min-width: 200px;
padding: 0.5rem 0; /* py-2 */
}
.dropdown-item {
position: relative;
}
.dropdown-link {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.625rem 1rem; /* px-4 py-2.5 */
color: var(--foreground);
transition: all 0.2s;
}
/* Apply hover effect directly to the link, and keep it active when hovering a child dropdown */
.dropdown-link:hover,
.dropdown-item:hover > .dropdown-link {
background-color: var(--secondary);
color: var(--accent-foreground);
}
/* Sub-Dropdowns */
.sub-dropdown {
display: none;
position: absolute;
top: 0;
left: 100%;
padding-left: 0.5rem; /* pl-2 */
z-index: 50;
}
.dropdown-item:hover .sub-dropdown {
display: block;
}
/* ------------------ Actions ------------------ */
.actions {
display: flex;
align-items: center;
gap: 1rem; /* gap-4 */
}
.action-btn {
padding: 0.5rem; /* p-2 */
border-radius: 9999px;
border: none;
background: transparent;
color: var(--foreground);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.2s;
}
.action-btn:hover {
background-color: var(--secondary);
}
.action-btn svg {
width: 1.25rem;
height: 1.25rem; /* w-5 h-5 */
}
.desktop-user {
display: none;
}
@media (min-width: 640px) {
.desktop-user {
display: flex;
}
}
.mobile-menu-btn {
display: flex;
}
@media (min-width: 1024px) {
.mobile-menu-btn {
display: none;
}
}
.cart-wrapper {
position: relative;
}
.cart-badge {
position: absolute;
top: -0.25rem;
right: -0.25rem; /* -top-1 -right-1 */
width: 1.25rem;
height: 1.25rem; /* w-5 h-5 */
background-color: var(--accent);
color: var(--accent-foreground);
border-radius: 9999px;
display: flex;
align-items: center;
justify-content: center;
}
/* ------------------ Search Bar ------------------ */
.search-container {
padding-bottom: 1rem; /* pb-4 */
animation: slideDown 0.2s ease-out;
}
.search-input-wrapper {
position: relative;
}
.search-input {
width: 100%;
padding: 0.75rem 1rem 0.75rem 3rem; /* px-4 py-3 pl-12 */
background-color: var(--secondary);
border: 1px solid transparent;
border-radius: 0.5rem; /* rounded-lg */
color: var(--foreground);
outline: none;
transition: all 0.2s;
}
.search-input::placeholder {
color: var(--muted-foreground);
}
.search-input:focus {
box-shadow: 0 0 0 2px var(--ring);
}
.search-icon {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
color: var(--muted-foreground);
width: 1.25rem;
height: 1.25rem;
}
/* ------------------ Mobile Menu ------------------ */
.mobile-menu {
border-top: 1px solid var(--border);
animation: slideDown 0.2s ease-out;
}
@media (min-width: 1024px) {
.mobile-menu {
display: none !important;
}
}
.mobile-nav-inner {
padding: 1rem 0; /* py-4 */
display: flex;
flex-direction: column;
gap: 0.25rem; /* space-y-1 */
}
.mobile-item-wrap {
position: relative;
}
.mobile-item-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.mobile-link {
flex: 1;
padding: 0.5rem 0; /* py-2 */
color: var(--foreground);
transition: color 0.2s;
}
.mobile-link:hover {
color: var(--accent-foreground);
}
.mobile-toggle {
padding: 0.5rem;
border: none;
background: transparent;
border-radius: 9999px;
color: var(--foreground);
}
.mobile-toggle:hover {
background-color: var(--secondary);
}
.mobile-toggle svg {
width: 1rem;
height: 1rem;
transition: transform 0.2s;
}
.mobile-toggle.active svg {
transform: rotate(180deg);
}
.mobile-sub-menu {
border-left: 2px solid var(--border);
margin-left: 0.5rem; /* ml-2 */
padding-left: 1rem; /* pl-4 */
}
.mobile-contact {
padding-top: 1rem; /* pt-4 */
margin-top: 0.5rem;
border-top: 1px solid var(--border);
color: var(--muted-foreground);
font-size: 0.875rem;
}
@media (min-width: 640px) {
.mobile-contact {
display: none;
}
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-0.5rem);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded", () => {
// 1. Search Bar Toggle
const searchBtn = document.getElementById("search-toggle");
const searchBar = document.getElementById("search-bar");
if (searchBtn && searchBar) {
searchBtn.addEventListener("click", () => {
searchBar.classList.toggle("hidden");
if (!searchBar.classList.contains("hidden")) {
searchBar.querySelector("input").focus();
}
});
}
// 2. Mobile Menu Toggle
const mobileBtn = document.getElementById("mobile-menu-toggle");
const mobileMenu = document.getElementById("mobile-menu");
const iconOpen = document.getElementById("menu-icon-open");
const iconClose = document.getElementById("menu-icon-close");
if (mobileBtn && mobileMenu) {
mobileBtn.addEventListener("click", () => {
mobileMenu.classList.toggle("hidden");
iconOpen.classList.toggle("hidden");
iconClose.classList.toggle("hidden");
});
}
// 3. Mobile Sub-Menu Toggles
const submenuToggles = document.querySelectorAll(".js-submenu-toggle");
submenuToggles.forEach((toggle) => {
toggle.addEventListener("click", (e) => {
// Toggle rotation class on button
toggle.classList.toggle("active");
// Find the sibling submenu div and toggle hidden class
const submenu = toggle.parentElement.nextElementSibling;
if (submenu && submenu.classList.contains("mobile-sub-menu")) {
submenu.classList.toggle("hidden");
}
});
});
});
</script>
</header>