|
|
|
@@ -1,6 +1,5 @@
|
|
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import Image from "next/image";
|
|
|
|
|
import Link from "next/link";
|
|
|
|
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
|
|
|
import { ChevronDown, Heart, LayoutGrid, Menu, MessageCircle, PackageCheck, ShoppingCart, UserRound } from "lucide-react";
|
|
|
|
@@ -46,26 +45,27 @@ export function Navbar({ products, categories }: { products: Product[]; categori
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<header className="sticky top-0 z-40 border-b border-slate-200/80 bg-white/95 shadow-sm backdrop-blur-xl">
|
|
|
|
|
<div className="bg-gradient-to-r from-amber-300 via-yellow-200 to-lime-200 px-4 py-2 text-center text-xs font-black text-slate-950 sm:text-sm">
|
|
|
|
|
Paga tus compras a cuotas · Envíos nacionales · <span className="underline decoration-2 underline-offset-2">Compra segura con ARI</span>
|
|
|
|
|
<div className="bg-ari-marino px-4 py-2 text-center text-xs font-black text-white sm:text-sm">
|
|
|
|
|
Paga tus compras a cuotas · Envíos nacionales · <span className="underline decoration-ari-coral-claro decoration-2 underline-offset-2">Compra segura con ARI</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="relative overflow-visible bg-white">
|
|
|
|
|
<div className="pointer-events-none absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-cyan-400 via-violet-500 to-fuchsia-500" />
|
|
|
|
|
<div className="mx-auto grid max-w-7xl grid-cols-[72px_1fr_auto] items-center gap-4 px-4 py-4 lg:grid-cols-[92px_minmax(420px,1fr)_auto] lg:gap-8">
|
|
|
|
|
<Link href="/" className="relative size-16 overflow-hidden rounded-full border-2 border-slate-900 bg-black shadow-lg lg:size-20">
|
|
|
|
|
<Image src="/images/brand/logo-ari.png" alt="ARI Shopping" fill priority sizes="80px" className="object-cover" />
|
|
|
|
|
<div className="pointer-events-none absolute inset-x-0 top-0 h-1 bg-ari-coral" />
|
|
|
|
|
<div className="mx-auto grid max-w-7xl grid-cols-[auto_1fr_auto] items-center gap-4 px-4 py-4 lg:gap-8">
|
|
|
|
|
<Link href="/" aria-label="ARI shopping" className="shrink-0">
|
|
|
|
|
{/* eslint-disable-next-line @next/next/no-img-element -- vector propio, next/image no optimiza SVG sin habilitar dangerouslyAllowSVG */}
|
|
|
|
|
<img src="/images/brand/logo-ari.svg" alt="ARI shopping" className="h-11 w-auto lg:h-14" width={200} height={64} />
|
|
|
|
|
</Link>
|
|
|
|
|
<PredictiveSearch />
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<Button variant="outline" size="icon" aria-label="Mi cuenta" className="hidden border-slate-300 bg-white text-slate-900 hover:border-violet-400 hover:bg-violet-50 sm:inline-flex" onClick={() => setAccountOpen(true)}><UserRound /></Button>
|
|
|
|
|
<Button variant="outline" size="icon" aria-label={`Favoritos: ${wishlistCount}`} className="relative hidden border-slate-300 bg-white text-slate-900 hover:border-fuchsia-400 hover:bg-fuchsia-50 sm:inline-flex" onClick={openWishlist}>
|
|
|
|
|
<Button variant="outline" size="icon" aria-label="Mi cuenta" className="hidden border-slate-300 bg-white text-slate-900 hover:border-ari-coral hover:bg-ari-coral/10 sm:inline-flex" onClick={() => setAccountOpen(true)}><UserRound /></Button>
|
|
|
|
|
<Button variant="outline" size="icon" aria-label={`Favoritos: ${wishlistCount}`} className="relative hidden border-slate-300 bg-white text-slate-900 hover:border-ari-coral hover:bg-ari-coral/10 sm:inline-flex" onClick={openWishlist}>
|
|
|
|
|
<Heart />
|
|
|
|
|
{wishlistCount > 0 && <span className="absolute -right-1.5 -top-1.5 grid size-5 place-items-center rounded-full bg-violet-600 text-[10px] font-black text-white">{wishlistCount}</span>}
|
|
|
|
|
{wishlistCount > 0 && <span className="absolute -right-1.5 -top-1.5 grid size-5 place-items-center rounded-full bg-ari-marino text-[10px] font-black text-white">{wishlistCount}</span>}
|
|
|
|
|
</Button>
|
|
|
|
|
<Button variant="primary" size="icon" onClick={openCart} aria-label={`Carrito con ${count} productos`} className="relative shadow-lg shadow-fuchsia-500/20">
|
|
|
|
|
<Button variant="primary" size="icon" onClick={openCart} aria-label={`Carrito con ${count} productos`} className="relative">
|
|
|
|
|
<ShoppingCart />
|
|
|
|
|
<span className="absolute -right-2 -top-2 grid size-6 place-items-center rounded-full bg-yellow-300 text-[11px] font-black text-slate-950">{count}</span>
|
|
|
|
|
<span className="absolute -right-2 -top-2 grid size-6 place-items-center rounded-full bg-ari-marino text-[11px] font-black text-white">{count}</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@@ -82,7 +82,7 @@ export function Navbar({ products, categories }: { products: Product[]; categori
|
|
|
|
|
<SheetDescription>Categorías y colecciones del catálogo.</SheetDescription>
|
|
|
|
|
</SheetHeader>
|
|
|
|
|
<div className="flex-1 overflow-y-auto p-6">
|
|
|
|
|
<p className="mb-3 text-xs font-black uppercase tracking-[.16em] text-fuchsia-600">Categorías</p>
|
|
|
|
|
<p className="mb-3 text-xs font-black uppercase tracking-[.16em] text-ari-coral">Categorías</p>
|
|
|
|
|
<div className="grid gap-2">
|
|
|
|
|
<Suspense fallback={<MobileCategoryLinksFallback tree={tree} onNavigate={() => setMenuOpen(false)} />}>
|
|
|
|
|
<MobileCategoryLinks tree={tree} onNavigate={() => setMenuOpen(false)} />
|
|
|
|
@@ -90,9 +90,9 @@ export function Navbar({ products, categories }: { products: Product[]; categori
|
|
|
|
|
</div>
|
|
|
|
|
{collections.length > 0 && (
|
|
|
|
|
<>
|
|
|
|
|
<p className="mb-3 mt-8 text-xs font-black uppercase tracking-[.16em] text-violet-600">Colecciones</p>
|
|
|
|
|
<p className="mb-3 mt-8 text-xs font-black uppercase tracking-[.16em] text-ari-marino">Colecciones</p>
|
|
|
|
|
<div className="flex flex-wrap gap-2">
|
|
|
|
|
{collections.map((collection) => <Link key={collection} href={`/catalog?collection=${encodeURIComponent(collection)}`} onClick={() => setMenuOpen(false)} className="rounded-full bg-slate-100 px-4 py-2 text-sm font-bold hover:bg-violet-100 hover:text-violet-700">{collection}</Link>)}
|
|
|
|
|
{collections.map((collection) => <Link key={collection} href={`/catalog?collection=${encodeURIComponent(collection)}`} onClick={() => setMenuOpen(false)} className="rounded-full bg-slate-100 px-4 py-2 text-sm font-bold hover:bg-ari-coral/10 hover:text-ari-coral">{collection}</Link>)}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
@@ -107,7 +107,7 @@ export function Navbar({ products, categories }: { products: Product[]; categori
|
|
|
|
|
<Dialog open={accountOpen} onOpenChange={setAccountOpen}>
|
|
|
|
|
<DialogContent className="max-w-lg p-7">
|
|
|
|
|
<div className="pr-10">
|
|
|
|
|
<span className="text-xs font-black uppercase tracking-[.16em] text-violet-600">Atención personalizada</span>
|
|
|
|
|
<span className="text-xs font-black uppercase tracking-[.16em] text-ari-coral">Atención personalizada</span>
|
|
|
|
|
<h2 className="mt-3 text-3xl font-black">Tu cuenta ARI</h2>
|
|
|
|
|
<p className="mt-3 text-sm leading-6 text-slate-600">El inicio de sesión quedará conectado al backend headless. Mientras tanto, puedes gestionar pedidos y disponibilidad directamente por WhatsApp.</p>
|
|
|
|
|
<div className="mt-6 grid gap-3">
|
|
|
|
@@ -136,16 +136,16 @@ function useCategoryNavigationState() {
|
|
|
|
|
function pillClass(active: boolean): string {
|
|
|
|
|
return `shrink-0 rounded-full px-4 py-2 text-sm font-extrabold transition ${
|
|
|
|
|
active
|
|
|
|
|
? "bg-gradient-to-r from-cyan-500 to-violet-500 text-white shadow-lg shadow-violet-950/30"
|
|
|
|
|
: "text-white/90 hover:bg-gradient-to-r hover:from-cyan-500 hover:to-violet-500 hover:text-white"
|
|
|
|
|
? "bg-white text-ari-marino shadow-lg shadow-black/10"
|
|
|
|
|
: "text-white/90 hover:bg-white/10 hover:text-white"
|
|
|
|
|
}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mobileLinkClass(active: boolean): string {
|
|
|
|
|
return `rounded-2xl border px-4 py-3 font-extrabold transition ${
|
|
|
|
|
active
|
|
|
|
|
? "border-violet-500 bg-violet-50 text-violet-700"
|
|
|
|
|
: "border-slate-200 hover:border-cyan-400 hover:bg-cyan-50"
|
|
|
|
|
? "border-ari-coral bg-ari-coral/5 text-ari-coral"
|
|
|
|
|
: "border-slate-200 hover:border-ari-coral/50 hover:bg-ari-coral/5"
|
|
|
|
|
}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -170,7 +170,7 @@ function CategoryNavBar({
|
|
|
|
|
isAllActive: boolean;
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<nav className="border-b-4 border-fuchsia-500 bg-slate-950 text-white">
|
|
|
|
|
<nav className="bg-ari-marino text-white">
|
|
|
|
|
<div className="mx-auto flex max-w-7xl items-center gap-1 px-4 py-2">
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
@@ -227,7 +227,7 @@ function DepartmentsMegaMenu({ tree, isActive }: { tree: CategoryNode[]; isActiv
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
{open && (
|
|
|
|
|
<div className="absolute left-0 top-full z-50 mt-1 w-[min(92vw,64rem)] rounded-2xl border border-slate-800 bg-slate-950 p-6 shadow-2xl">
|
|
|
|
|
<div className="absolute left-0 top-full z-50 mt-1 w-[min(92vw,64rem)] rounded-2xl border border-white/10 bg-ari-marino p-6 shadow-2xl">
|
|
|
|
|
<div className="grid grid-cols-2 gap-x-6 gap-y-5 sm:grid-cols-3 lg:grid-cols-6">
|
|
|
|
|
{tree.map((root) => (
|
|
|
|
|
<div key={root.id}>
|
|
|
|
@@ -237,7 +237,7 @@ function DepartmentsMegaMenu({ tree, isActive }: { tree: CategoryNode[]; isActiv
|
|
|
|
|
aria-current={isActive(root.name) ? "page" : undefined}
|
|
|
|
|
onClick={() => setOpen(false)}
|
|
|
|
|
className={`block text-sm font-black uppercase tracking-wide transition ${
|
|
|
|
|
isActive(root.name) ? "text-fuchsia-400" : "text-white hover:text-fuchsia-400"
|
|
|
|
|
isActive(root.name) ? "text-ari-coral-claro" : "text-white hover:text-ari-coral-claro"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
{root.name}
|
|
|
|
@@ -251,7 +251,7 @@ function DepartmentsMegaMenu({ tree, isActive }: { tree: CategoryNode[]; isActiv
|
|
|
|
|
prefetch={false}
|
|
|
|
|
aria-current={isActive(child.name) ? "page" : undefined}
|
|
|
|
|
onClick={() => setOpen(false)}
|
|
|
|
|
className={`block text-sm transition ${isActive(child.name) ? "font-bold text-violet-300" : "text-white/70 hover:text-white"}`}
|
|
|
|
|
className={`block text-sm transition ${isActive(child.name) ? "font-bold text-ari-coral-claro" : "text-white/70 hover:text-white"}`}
|
|
|
|
|
>
|
|
|
|
|
{child.name}
|
|
|
|
|
</Link>
|
|
|
|
|