import { Link, useLocation, useNavigate } from "@remix-run/react"; import { useState, type FormEvent } from "react"; import { Search, Heart, ShoppingBag, User } from "lucide-react"; import { useRootData } from "~/hooks/use-root-data"; import { useCartCount } from "~/requestHandler/use-cart-hooks"; import logo from "~/assets/logo/SVG-07.svg"; const NAV = [ { label: "خانه", to: "/" }, { label: "کاوش", to: "/explore" }, { label: "برندها", to: "/sellers" }, { label: "کالکشن‌ها", to: "/collections" }, ]; /** * Desktop-only top chrome (sticky header with brand, nav, search and actions). * Hidden below the `lg` breakpoint; the mobile experience is unchanged. */ const DesktopHeader = () => { const location = useLocation(); const navigate = useNavigate(); const { user } = useRootData(); const cartCount = useCartCount(); const [q, setQ] = useState(""); const isActive = (to: string) => to === "/" ? location.pathname === "/" : location.pathname.startsWith(to); const onSearch = (e: FormEvent) => { e.preventDefault(); const term = q.trim(); if (term) navigate(`/search/${encodeURIComponent(term)}`); }; return (
ویترون ویترون
setQ(e.target.value)} name="q" placeholder="جستجوی محصول، برند یا فروشگاه…" aria-label="جستجو" className="w-full bg-transparent outline-none text-[14.5px] text-BLACK placeholder:text-GRAY" />
{cartCount > 0 && user?.access_token ? ( {cartCount} ) : null}
); }; export default DesktopHeader;