import { Menu as MenuIcon, ShoppingBag, Search } from "lucide-react"; import { useState } from "react"; import { Link } from "react-router"; import { useShopifyCart } from "@/hooks/use-shopify-cart"; import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet"; import { cn } from "@/lib/utils"; export type NavigationProps = { brand: string; logo?: string; links: Array<{ label: string; href: string }>; showSearch: "yes" | "no"; showCart: "yes" | "no"; sticky: "yes" | "no"; tone: "default" | "muted" | "inverse"; bannerText: string; bannerTone: "default" | "accent" | "inverse"; }; export function Navigation({ brand, logo, links, showSearch, showCart, sticky, tone, bannerText, bannerTone, }: NavigationProps) { const [mobileOpen, setMobileOpen] = useState(false); const [cartOpen, setCartOpen] = useState(false); const cart = useShopifyCart(); const itemCount = cart?.itemCount ?? 0; const toneClass: Record = { default: "bg-background text-foreground border-b border-border", muted: "bg-muted/40 text-foreground border-b border-border", inverse: "bg-foreground text-background", }; const bannerToneClass: Record = { default: "bg-muted text-foreground", accent: "bg-primary text-primary-foreground", inverse: "bg-foreground text-background", }; const hasBanner = typeof bannerText === "string" && bannerText.trim().length > 0; return ( <>
{hasBanner && (
{bannerText}
)}
{logo ? ( {brand ) : ( brand || "Brand Logo" )}
{showSearch === "yes" && ( )} {showCart === "yes" && ( )}
{/* Mobile menu */} {brand} {/* Cart drawer */} Cart
{cart?.items?.length ? (
    {cart.items.map((line: any) => (
  • {line.merchandise?.product?.images?.edges?.[0]?.node?.url ? ( {line.merchandise.product.title} ) : null}

    {line.merchandise?.product?.title}

    {line.merchandise?.title && line.merchandise.title !== "Default Title" ? (

    {line.merchandise.title}

    ) : null}
    {line.quantity}
    {line.merchandise?.price ? new Intl.NumberFormat("en-US", { style: "currency", currency: line.merchandise.price.currencyCode, }).format(parseFloat(line.merchandise.price.amount) * line.quantity) : null}
  • ))}
) : (

Your cart is empty.

)}
{cart?.items?.length ? (
Subtotal {new Intl.NumberFormat("en-US", { style: "currency", currency: cart.cart?.cost?.totalAmount?.currencyCode ?? "USD", }).format(cart.totalAmount)}
Checkout
) : null}
); }