Match GL capsule navbar and simplify canvas/card layering

This commit is contained in:
Ruslan Bakiev
2026-04-03 09:42:43 +07:00
parent 8f54743235
commit 5597c468a2
3 changed files with 66 additions and 64 deletions

View File

@@ -2,20 +2,19 @@
type NavItem = {
to: string;
label: string;
icon: string;
};
const route = useRoute();
const { totalItems } = useClientCart();
const centerCapsule: NavItem[] = [
{ to: '/products', label: 'Каталог', icon: 'grid' },
{ to: '/orders', label: 'Мои заказы', icon: 'stack' },
{ to: '/products', label: 'Каталог' },
{ to: '/orders', label: 'Мои заказы' },
];
const rightCapsule: NavItem[] = [
{ to: '/cart', label: 'Корзина', icon: 'cart' },
{ to: '/profile', label: 'Профиль', icon: 'user' },
{ to: '/cart', label: 'Корзина' },
{ to: '/profile', label: 'Профиль' },
];
function isActive(path: string) {
@@ -30,52 +29,52 @@ function isActive(path: string) {
<header class="fregat-header-glass fixed inset-x-0 top-0 z-50 border-0">
<div class="fregat-header-backdrop" aria-hidden="true" />
<div class="relative mx-auto max-w-[2200px] px-4 py-2 md:px-6">
<div class="fregat-header-row relative flex min-h-[3rem] items-center">
<div class="relative mx-auto max-w-[2200px] px-3 py-2 md:px-4">
<div class="fregat-header-row relative flex items-center">
<NuxtLink
to="/"
class="fregat-pill-glass fregat-pill-shell fregat-pill-brand inline-flex items-center gap-2 rounded-full px-4 py-2 text-sm font-extrabold text-base-content"
class="fregat-pill-glass fregat-pill-shell fregat-pill-brand inline-flex items-center justify-center rounded-full px-5 text-base font-extrabold tracking-[0.03em] text-base-content"
>
<span class="inline-flex h-2.5 w-2.5 rounded-full bg-[#139957]" />
Fregat
</NuxtLink>
<div class="fregat-pill-glass fregat-pill-shell fregat-pill-center flex min-w-0 flex-1 items-center gap-1 rounded-full p-1 lg:absolute lg:left-1/2 lg:w-auto lg:-translate-x-1/2">
<NuxtLink
v-for="item in centerCapsule"
:key="item.to"
:to="item.to"
:class="['lk-nav-link', { 'lk-nav-link-active': isActive(item.to) }]"
>
<svg v-if="item.icon === 'grid'" class="h-4 w-4" viewBox="0 0 24 24" fill="none">
<path d="M4 4h7v7H4V4Zm9 0h7v7h-7V4ZM4 13h7v7H4v-7Zm9 0h7v7h-7v-7Z" fill="currentColor" />
</svg>
<svg v-else class="h-4 w-4" viewBox="0 0 24 24" fill="none">
<path d="M5 5h14v3H5V5Zm0 5h14v3H5v-3Zm0 5h14v4H5v-4Z" fill="currentColor" />
</svg>
{{ item.label }}
</NuxtLink>
</div>
<nav class="fregat-pill-glass fregat-pill-shell fregat-pill-center flex min-w-0 flex-1 items-center rounded-full p-1 lg:absolute lg:left-1/2 lg:w-auto lg:-translate-x-1/2">
<template v-for="(item, index) in centerCapsule" :key="item.to">
<NuxtLink
:to="item.to"
:class="['lk-nav-link', { 'lk-nav-link-active': isActive(item.to) }]"
>
{{ item.label }}
</NuxtLink>
<div
v-if="index < centerCapsule.length - 1"
class="lk-pill-divider mx-1 h-6 w-px shrink-0"
aria-hidden="true"
/>
</template>
</nav>
<div class="fregat-pill-glass fregat-pill-shell fregat-pill-right flex min-w-0 items-center gap-1 rounded-full p-1 lg:absolute lg:right-0 lg:w-auto">
<NuxtLink
v-for="item in rightCapsule"
:key="item.to"
:to="item.to"
:class="['lk-nav-link', { 'lk-nav-link-active': isActive(item.to) }]"
>
<svg v-if="item.icon === 'cart'" class="h-4 w-4" viewBox="0 0 24 24" fill="none">
<path d="M7 4h-2l-1 2v2h1l2.2 9h10.6l2.2-7H8.3L7.8 8H21V6h-12l-1-2Zm2 16a2 2 0 1 0 0 .01V20Zm8 0a2 2 0 1 0 0 .01V20Z" fill="currentColor" />
</svg>
<svg v-else class="h-4 w-4" viewBox="0 0 24 24" fill="none">
<path d="M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Z" fill="currentColor" />
</svg>
<span class="hidden sm:inline">{{ item.label }}</span>
<span v-if="item.to === '/cart' && totalItems > 0" class="badge badge-sm border-0 bg-[#139957] text-white">
{{ totalItems }}
</span>
</NuxtLink>
</div>
<nav class="fregat-pill-glass fregat-pill-shell fregat-pill-right flex min-w-0 items-center rounded-full p-1 lg:absolute lg:right-0 lg:w-auto">
<template v-for="(item, index) in rightCapsule" :key="item.to">
<NuxtLink
:to="item.to"
:class="['lk-nav-link', { 'lk-nav-link-active': isActive(item.to) }]"
>
<span>{{ item.label }}</span>
<span
v-if="item.to === '/cart' && totalItems > 0"
class="badge badge-sm border-0 bg-[#139957] text-white"
>
{{ totalItems }}
</span>
</NuxtLink>
<div
v-if="index < rightCapsule.length - 1"
class="lk-pill-divider mx-1 h-6 w-px shrink-0"
aria-hidden="true"
/>
</template>
</nav>
</div>
</div>
</header>