'use client'; /** * Cart link for the site header (bare skeleton): a client island so it can read * the live item count from useCart(). * * It is a real LINK to /cart, so keyboard and screen-reader users reach the cart * like everyone else. `itemCount` is the store's own number: before the cart's * first answer it is the count remembered from the previous visit, so the count * is right from the first frame. The accessible name carries the count, so the * visible count is `aria-hidden`; it renders nothing at zero. */ import * as React from 'react'; import { SmartLink } from '@/core/lib/navigation'; import { useCart } from '@/core/providers/store-provider'; import { useTranslations } from '@/core/lib/translations'; export function HeaderCart() { const { itemCount } = useCart(); const t = useTranslations('nav'); const label = itemCount <= 0 ? t('cart') : itemCount === 1 ? t('cartCountOne') : t('cartCountOther', { count: String(itemCount) }); return ( {/* DESIGN ME — header cart link: icon + count badge; count via useCart().itemCount, label via the `nav` translation namespace. Keep it a link to /cart with the aria-label above. Compose with the shadcn/ui primitives in src/components/ui (Button, Card, Badge, Input, Select, Accordion, Dialog, Skeleton, ...) + lucide-react icons. */} {t('cart')} {itemCount > 0 && ( )} ); }