34 lines
816 B
TypeScript
34 lines
816 B
TypeScript
'use client'
|
|
|
|
import {ShoppingCartIcon} from 'lucide-react'
|
|
import {useTranslations} from 'next-intl'
|
|
|
|
import {dump} from '@/lib/utils'
|
|
import useCartStore, {CartItem} from '@/store/cart-store'
|
|
import {Button} from '@/ui/button'
|
|
|
|
export default function AddCartButton({product}: {product: CartItem}) {
|
|
const t = useTranslations('cart')
|
|
const addItemToCart = useCartStore(state => state.addItemToCart)
|
|
const {cartItems} = useCartStore(state => state)
|
|
|
|
return (
|
|
<>
|
|
{/*<Button
|
|
className='bw-cart-btn flex flex-col items-center border-0 shadow-none'
|
|
variant='outline'
|
|
title={t('basket')}
|
|
onClick={() => addItemToCart(product)}
|
|
>
|
|
|
|
</Button>*/}
|
|
|
|
<ShoppingCartIcon
|
|
role='button'
|
|
className='bw-cart-btn h-[24px] w-[24px]'
|
|
onClick={() => addItemToCart(product)}
|
|
/>
|
|
</>
|
|
)
|
|
}
|