grand commit

This commit is contained in:
2025-02-07 08:34:42 +02:00
parent f594f001f6
commit c6c34f0453
53 changed files with 1283 additions and 625 deletions

View File

@@ -0,0 +1,33 @@
'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)}
/>
</>
)
}

View File

@@ -0,0 +1,31 @@
'use client'
import {ShoppingCartIcon} from 'lucide-react'
import {useTranslations} from 'next-intl'
import useCartStore, {CartItem} from '@/store/cart-store'
import {Button} from '@/ui/button'
export default function CardBuyButton({
item,
isIcon
}: {
item: CartItem
isIcon?: boolean
}) {
const t = useTranslations('cart')
const addItemToCart = useCartStore(state => state.addItemToCart)
return (
<Button
className={`mr-2 ${isIcon ? '' : 'w-[80px]'} grow-0 shadow-white hover:shadow-md hover:shadow-brand-violet/50`}
onClick={() => addItemToCart(item)}
>
{isIcon ? (
<ShoppingCartIcon role='button' className='bw-cart-btn p-1' />
) : (
t('buy')
)}
</Button>
)
}

View File

@@ -0,0 +1,71 @@
import {ProductResource} from '@prisma/client'
import {Star, StarHalf} from 'lucide-react'
import Image from 'next/image'
import CardBuyButton from '@/components/shared/store/card-buy-button'
import RateStars from '@/components/shared/store/stars'
import {Link} from '@/i18n/routing'
import {CategoryPageSqlSchema} from '@/lib/data/models/sqlSchemas'
import {Button} from '@/ui/button'
import {Card, CardContent, CardFooter} from '@/ui/card'
import {CarouselItem} from '@/ui/carousel'
export default function FeatureCardFront({
card
}: {
card: CategoryPageSqlSchema
}) {
return (
<Card className='relative aspect-card overflow-hidden border-[2px] border-brand-violet transition duration-300 hover:shadow-lg hover:shadow-brand-violet/50'>
<Link href={`/product/${card.productId}-${card.slug}`}>
<CardContent className='relative flex h-[81%] flex-col justify-between overflow-hidden pt-4'>
{/*<CarouselItem>*/}
<Image
className='transition duration-300 hover:scale-110'
src={card?.image || ''}
width={card.imageWidth || 100}
height={card.imageHeight || 100}
/*className='object-scale-down'*/
priority
alt={''}
sizes='100vw'
style={{
objectFit: 'contain',
width: '100%',
height: 'calc(100% - 24px)'
}}
/>
<RateStars />
{/*</CarouselItem>*/}
</CardContent>
</Link>
<div className='bw-card-footer flex h-[19%] items-center justify-between border-t-[2px] border-brand-violet px-4'>
<div className=''>
<p className='ml-2 border-b border-b-brand-violet pl-2 pr-6 text-[16px]'>
{card.title}
</p>
<p className='pl-4 text-[16px] font-bold text-brand-violet'>
{parseFloat(card.price as string).toFixed(2)}
</p>
</div>
<CardBuyButton
item={{
id: card.productId,
quantity: 1,
title: card.title,
price: parseFloat(card.price as string).toFixed(2)
}}
isIcon={true}
/>
</div>
</Card>
)
}
// id: number
// quantity: number
// title: string
// price: string | any
// image?: string | null
// imageWidth?: number | null
// imageHeight?: number | null

View File

@@ -0,0 +1,65 @@
import {Star, StarHalf} from 'lucide-react'
import Image from 'next/image'
import CardBuyButton from '@/components/shared/store/card-buy-button'
import RateStars from '@/components/shared/store/stars'
import {Link} from '@/i18n/routing'
import {Button} from '@/ui/button'
import {Card, CardContent, CardFooter} from '@/ui/card'
//import {CarouselItem} from '@/ui/carousel'
export default function FeatureCard({card}: {card: any}) {
return (
<Card className='relative aspect-card overflow-hidden border-[2px] border-brand-violet transition duration-300 hover:shadow-lg hover:shadow-brand-violet/50'>
<Link href={`/product/${card.productId}-${card.slug}`}>
<CardContent className='relative flex h-[81%] flex-col justify-between overflow-hidden pt-4'>
{/*<CarouselItem>*/}
<Image
className='transition duration-300 hover:scale-110'
src={card.image}
width={card.imageWidth}
height={card.imageHeight}
/*className='object-scale-down'*/
priority
alt={''}
sizes='100vw'
style={{
objectFit: 'contain',
width: '100%',
height: 'calc(100% - 24px)'
}}
/>
<RateStars />
</CardContent>
</Link>
<div className='bw-card-footer flex h-[19%] items-center justify-between border-t-[2px] border-brand-violet px-4'>
<div className=''>
<p className='ml-2 border-b border-b-brand-violet pl-2 pr-6'>
{card.title}
</p>
<p className='pl-4 text-[18px] font-bold text-brand-violet'>
{parseFloat(card.price).toFixed(2)}
</p>
</div>
<CardBuyButton
item={{
id: card.productId,
quantity: 1,
title: card.title,
price: parseFloat(card.price).toFixed(2),
image: card.image
}}
/>
</div>
</Card>
)
}
// id: number
// quantity: number
// title: string
// price: string | any
// image?: string | null
// imageWidth?: number | null
// imageHeight?: number | null

View File

@@ -0,0 +1,16 @@
import {Star} from 'lucide-react'
const startStroke = 1.5
const color = '#ffd139'
export default function RateStars() {
return (
<div className='bw-rating absolute bottom-2 left-4 inline-flex h-[32px] items-center gap-1'>
<Star strokeWidth={startStroke} color={color} fill={color} />
<Star strokeWidth={startStroke} color={color} fill={color} />
<Star strokeWidth={startStroke} color={color} fill={color} />
<Star strokeWidth={startStroke} color={color} />
<Star strokeWidth={startStroke} color={color} />
</div>
)
}