stuff done
This commit is contained in:
@@ -9,13 +9,13 @@ export default function HeaderControls() {
|
||||
const t = useTranslations('cart')
|
||||
|
||||
return (
|
||||
<div className='flex w-full justify-end gap-x-6 text-brand-violet'>
|
||||
<div className='flex w-full items-center justify-end gap-x-2 text-brand-violet'>
|
||||
<CabinetButton />
|
||||
|
||||
<Link href={'#' as never} className='header-button' aria-label='Вибране'>
|
||||
<button className='flex flex-col items-center' role='button'>
|
||||
<Heart className='h-[21px] w-[21px]' />
|
||||
<span className='font1-bold text-sm'>{t('favorites')}</span>
|
||||
{/*<span className='font1-bold text-sm'>{t('favorites')}</span>*/}
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
|
||||
@@ -4,21 +4,30 @@ import {ShoppingCartIcon} from 'lucide-react'
|
||||
import {useTranslations} from 'next-intl'
|
||||
|
||||
import {Link} from '@/i18n/routing'
|
||||
import useCartStore from '@/store/cart-store'
|
||||
import useCartStore, {CartItem} from '@/store/cart-store'
|
||||
|
||||
export default function HeaderShoppingCartIcon() {
|
||||
const t = useTranslations('cart')
|
||||
const t = useTranslations('Common')
|
||||
const {cartItems} = useCartStore()
|
||||
const cartCount = cartItems.length
|
||||
const cartCount = cartItems.reduce(
|
||||
(accumulator: number, item: CartItem) => accumulator + item.quantity,
|
||||
0
|
||||
)
|
||||
|
||||
return (
|
||||
<Link href={'/cart' as never} className='header-button' aria-label='Кошик'>
|
||||
<Link
|
||||
href={'/cart' as never}
|
||||
className='header-button relative'
|
||||
aria-label={t('basket')}
|
||||
>
|
||||
<button className='flex flex-col items-center' role='button'>
|
||||
<ShoppingCartIcon className='h-[21px] w-[21px]' />
|
||||
|
||||
<span className='font1-bold text-sm'>
|
||||
{t('basket')} [{cartCount}]
|
||||
</span>
|
||||
{cartCount > 0 && (
|
||||
<div className='absolute -right-1 -top-1 h-[20px] w-[20px] rounded-full border border-brand-violet bg-brand-yellow pl-0 pr-[1px] text-[0.625rem] font-bold leading-[18px]'>
|
||||
{cartCount}
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
</Link>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user