Add category detail URLs and polish mega menu UX.

Route categories to /products/category/{id}/{slug}, improve menu hover/layout, and hide stock/category clutter on product cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-23 00:34:23 +03:30
co-authored by Cursor
parent 5d53cf91eb
commit f078cdad0e
11 changed files with 375 additions and 128 deletions
+28 -13
View File
@@ -32,17 +32,17 @@ export function Header({ categories = [] }: { categories?: NavCategory[] }) {
<Placeholder src={site.logo} alt={site.name} className="h-14 w-auto object-contain" />
</Link>
<nav className="mx-2 hidden items-center lg:flex">
<Link href="/" className="px-3 py-2 text-[14px] hover:text-brand">
<nav className="mx-2 hidden h-14 items-center lg:flex">
<Link href="/" className="inline-flex h-full items-center px-3 text-[14px] hover:text-brand">
خانه
</Link>
<div
className="relative"
className="relative flex h-full items-center"
onMouseEnter={() => setMegaOpen(true)}
onMouseLeave={() => setMegaOpen(false)}
>
<Link href="/products" className="flex items-center gap-1 px-3 py-2 text-[14px] hover:text-brand">
<Link href="/products" className="inline-flex h-full items-center gap-1 px-3 text-[14px] hover:text-brand">
محصولات
<ChevronDown className="size-3.5" />
</Link>
@@ -52,7 +52,11 @@ export function Header({ categories = [] }: { categories?: NavCategory[] }) {
{navLinks
.filter((link) => link.href !== "/" && link.href !== "/products")
.map((link) => (
<Link key={link.href} href={link.href} className="px-3 py-2 text-[14px] hover:text-brand">
<Link
key={link.href}
href={link.href}
className="inline-flex h-full items-center px-3 text-[14px] hover:text-brand"
>
{link.label}
</Link>
))}
@@ -107,14 +111,25 @@ export function Header({ categories = [] }: { categories?: NavCategory[] }) {
{category.title}
</Link>
{category.children.map((child) => (
<Link
key={child.id}
href={child.href}
className="block py-1 text-[12px] text-muted"
onClick={() => setOpen(false)}
>
{child.title}
</Link>
<div key={child.id} className="ps-2">
<Link
href={child.href}
className="block py-1 text-[12px] font-medium text-ink"
onClick={() => setOpen(false)}
>
{child.title}
</Link>
{child.children.map((leaf) => (
<Link
key={leaf.id}
href={leaf.href}
className="block py-1 ps-3 text-[12px] text-muted"
onClick={() => setOpen(false)}
>
{leaf.title}
</Link>
))}
</div>
))}
</div>
))