'use client'; /** * Cart link for the site header — client island so it can read the live * item count from useCart(). Icon + count bubble; the bubble hides at zero. * * It is a real LINK to /cart, so keyboard and screen-reader users reach the cart * like everyone else; the cart drawer never hijacks it. `itemCount` is the * store's own number: before the cart's first answer it is the count remembered * from the previous visit, so the bubble is right from the first frame. The * accessible name carries the count, so the bubble itself is `aria-hidden`. */ import * as React from 'react'; import { SmartLink } from '@/core/lib/navigation'; import { useCart } from '@/core/providers/store-provider'; import { useTranslations } from '@/core/lib/translations'; import { IconBag } from '@/ui/shared/icons'; 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 ( {itemCount > 0 && ( )} ); }