"use client"
import Image from 'next/image'
import { X, ShoppingBag, Plus, Minus, Trash2 } from 'lucide-react'
import Link from './LocalizedLink'
import { useCartStore } from '../store/cartStore'
import { formatPrice } from '@homaroma/types'
import { useTranslation } from 'react-i18next'
export default function CartDrawer() {
const { t } = useTranslation()
const { isCartOpen, toggleCart, items, updateQuantity, removeFromCart, getCartTotal } = useCartStore()
if (!isCartOpen) return null
return (
toggleCart(false)} />
{t('cart.title')}
{t('cart.items', { count: items.length })}
{items.length === 0 ? (
{t('cart.empty')}
) : (
items.map((item) => (
{item.productName}
{item.variantName &&
{item.variantName}
}
{formatPrice(item.price)}
{item.quantity}
))
)}
{items.length > 0 && (
{t('cart.subtotal')}
{formatPrice(getCartTotal())}
{t('cart.shippingNote')}
toggleCart(false)} className="block w-full rounded-full bg-text-main py-4 text-center text-sm font-bold uppercase tracking-widest text-surface-card transition hover:bg-brand-primary">
{t('cart.proceed')}
)}
)
}