increable offers + fix bugs

This commit is contained in:
hamid zarghami
2025-10-16 11:23:38 +03:30
parent 0a3b819a7e
commit 225329f342
13 changed files with 291 additions and 163 deletions
+15 -12
View File
@@ -4,9 +4,19 @@ import ProductCard from '@/components/ProductCard'
import Image from 'next/image'
import { Swiper, SwiperSlide } from 'swiper/react'
import { SHOP_CONFIG } from '@/config/const'
import { useGetLanding } from '../hooks/useHomeData'
const HotOffer: FC = () => {
const { data } = useGetLanding()
const incredibleOffers = data?.results?.incredibleOffers || []
if (!incredibleOffers.length) {
return null
}
return (
<div className='bg-[#F2F2F2] rounded-xl sm:rounded-2xl flex flex-col sm:flex-row py-4 sm:py-6'>
<div className='px-4 sm:px-6 w-full sm:min-w-[140px] sm:max-w-[180px] flex flex-col justify-center items-center sm:items-start'>
@@ -41,18 +51,11 @@ const HotOffer: FC = () => {
},
}}
>
<SwiperSlide className='!w-auto'>
<ProductCard />
</SwiperSlide>
<SwiperSlide className='!w-auto'>
<ProductCard />
</SwiperSlide>
<SwiperSlide className='!w-auto'>
<ProductCard />
</SwiperSlide>
<SwiperSlide className='!w-auto'>
<ProductCard />
</SwiperSlide>
{incredibleOffers.map((product) => (
<SwiperSlide key={product._id} className='!w-auto'>
<ProductCard item={product} />
</SwiperSlide>
))}
</Swiper>
</div>
</div>