"use client"; import { useState } from "react"; import Link from "next/link"; import Logo from "./Logo"; import SearchBox from "./SearchBox"; import { BagIcon, ChevronDownIcon, CloseIcon, MenuIcon } from "./icons"; import { socialLinks } from "./socialLinks"; import { headerNavLinks } from "@/data/site"; import { CUSTOMER_PORTAL_URL } from "@/lib/config"; import { categoryHref } from "@/lib/slug"; import type { CategoryNode } from "@/lib/types"; export default function Header({ categoryColumns }: { categoryColumns: CategoryNode[] }) { const [productsOpen, setProductsOpen] = useState(false); const [mobileOpen, setMobileOpen] = useState(false); const [mobileCategoriesOpen, setMobileCategoriesOpen] = useState(false); return (
{/* Row 1: logo / search / actions */}
{/* Row 2: nav + socials */}
{socialLinks.map(({ icon: Icon, label, href }) => ( ))}
{/* Mobile drawer */} {mobileOpen && (
setMobileOpen(false)} />
{mobileCategoriesOpen && (
{categoryColumns.map((col) => (
setMobileOpen(false)} > {col.nameFa}
    {col.children.map((sub) => (
  • setMobileOpen(false)} > {sub.nameFa}
  • ))}
))}
)} {headerNavLinks.map((link) => link.href.startsWith("#") ? ( {link.title} ) : ( setMobileOpen(false)} className="block py-3 text-sm font-bold text-ink border-b border-line" > {link.title} ) )} ورود / ثبت‌نام
{socialLinks.map(({ icon: Icon, label, href }) => ( ))}
)}
); }