api call ssr landing + latest product + ...
This commit is contained in:
@@ -1,8 +1,49 @@
|
||||
import { IProduct } from '@/types/landing.types'
|
||||
import { NumberFormat } from '@/config/func'
|
||||
import { Heart } from 'iconsax-react'
|
||||
import Image from 'next/image'
|
||||
import { FC } from 'react'
|
||||
|
||||
const ProductCard: FC = () => {
|
||||
type Props = {
|
||||
item?: IProduct
|
||||
}
|
||||
|
||||
|
||||
const ProductCard: FC<Props> = ({ item }) => {
|
||||
if (item) return (
|
||||
<div className='bg-white rounded-[40px] p-6 w-full max-w-[280px] mx-auto shadow'>
|
||||
<div className='flex justify-center'>
|
||||
<Image
|
||||
src={item.imagesUrl.cover}
|
||||
width={170}
|
||||
height={170}
|
||||
alt=''
|
||||
className='max-w-[150px] max-h-[150px] object-contain'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<h4 className='line-clamp-2 text-[#383E43] mt-6 text-sm text-center leading-5 h-12'>
|
||||
{item.title_fa}
|
||||
</h4>
|
||||
|
||||
<div className='flex justify-end items-center gap-1.5 mt-4'>
|
||||
<div className='size-2 rounded-full bg-red-500'></div>
|
||||
<div className='size-2 rounded-full bg-red-500'></div>
|
||||
<div className='size-2 rounded-full bg-red-500'></div>
|
||||
</div>
|
||||
|
||||
<div className='mt-5 text-sm'>
|
||||
{NumberFormat(item.default_variant.price.selling_price)} تومان
|
||||
</div>
|
||||
<div className='mt-1 text-sm text-[#7F7F7F] line-through'>
|
||||
{NumberFormat(item.default_variant.price.retailPrice)}
|
||||
</div>
|
||||
|
||||
<div className='flex justify-end'>
|
||||
<Heart size={20} color='#000' />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
return (
|
||||
<div className='bg-white rounded-[40px] p-6 w-full max-w-[280px] mx-auto shadow'>
|
||||
<div className='flex justify-center'>
|
||||
|
||||
Reference in New Issue
Block a user