From 531e213be96f32af4e2c05c45cfb847ff96d1695 Mon Sep 17 00:00:00 2001 From: devops Date: Sun, 26 Jul 2026 21:35:39 +0000 Subject: [PATCH] Add workloads/ecommerce/src/components/navigation/CategoryMenu.tsx --- .../components/navigation/CategoryMenu.tsx | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 workloads/ecommerce/src/components/navigation/CategoryMenu.tsx diff --git a/workloads/ecommerce/src/components/navigation/CategoryMenu.tsx b/workloads/ecommerce/src/components/navigation/CategoryMenu.tsx new file mode 100644 index 0000000..7da0d07 --- /dev/null +++ b/workloads/ecommerce/src/components/navigation/CategoryMenu.tsx @@ -0,0 +1,87 @@ +"use client"; + +import { usePathname, useSearchParams } from "next/navigation"; +import styles from "./CategoryMenu.module.css"; + +type MenuItem = { + label: string; + href: string; +}; + +/** + * Menú principal ARI Shopping. + * + * Hotfix de estabilidad: + * Se utilizan enlaces HTML nativos para que cada cambio de categoría + * realice una navegación completa. Esto evita conservar estados obsoletos + * del catálogo cuando únicamente cambia el query string. + */ +const MENU_ITEMS: readonly MenuItem[] = [ + { + label: "Juguetes para bebés", + href: "/catalog?category=Figuras", + }, + { + label: "Educativos", + href: "/catalog?category=Figuras§ion=educativos", + }, + { + label: "Muñecas y peluches", + href: "/catalog?category=Peluches", + }, + { + label: "Acción y aventura", + href: "/catalog?collection=Marvel", + }, + { + label: "Mochilas", + href: "/catalog?category=Mochilas", + }, + { + label: "Variedades", + href: "/catalog", + }, +]; + +function normalizeUrl(pathname: string, query: string): string { + return query ? `${pathname}?${query}` : pathname; +} + +export default function CategoryMenu() { + const pathname = usePathname(); + const searchParams = useSearchParams(); + const currentUrl = normalizeUrl(pathname, searchParams.toString()); + + return ( + + ); +} \ No newline at end of file