summaryrefslogtreecommitdiff
path: root/src/lib/category/components/Category.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/category/components/Category.jsx')
-rw-r--r--src/lib/category/components/Category.jsx30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/lib/category/components/Category.jsx b/src/lib/category/components/Category.jsx
index 374cdf78..f76e6e42 100644
--- a/src/lib/category/components/Category.jsx
+++ b/src/lib/category/components/Category.jsx
@@ -15,7 +15,6 @@ const Category = () => {
const [banner, setBanner] = useState([]);
const promotionProgram = useQuery('banner-promo-category-card', bannerApi({ type: 'banner-promo-category-card' }));
- // const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' }));
useEffect(() => {
const loadCategories = async () => {
@@ -36,28 +35,6 @@ const Category = () => {
}
loadCategories()
}, [])
-
- // useEffect(() => {
- // const loadCategories = async () => {
- // let dataCategories = await odooApi('GET', '/api/v1/category/tree')
- // dataCategories = dataCategories?.map((category) => {
- // category.childs = category.childs.map((child1Category) => {
- // return {
- // ...child1Category,
- // isOpen: false
- // }
- // })
- // return {
- // ...category,
- // isOpen: false
- // }
- // })
- // setCategories(dataCategories)
- // }
- // loadCategories()
- // }, [])
- // console.log("categories",categories)
-
return (
<DesktopView>
<div className='category-mega-box'>
@@ -67,8 +44,8 @@ const Category = () => {
href={createSlug('/shop/category/', category.name, category.id)}
className='category-mega-box__parent flex items-center'
>
- <div className='w-6 h-6 border mr-2 rounded-full flex justify-center items-center'>
- <Image src={category.image} alt='' width={16} height={16} />
+ <div className='mr-2 flex justify-center items-center'>
+ <Image src={category.image} alt='' width={25} height={25} />
</div>
{category.name}
</Link>
@@ -111,9 +88,8 @@ const Category = () => {
</div>
<div className='category-mega-box__child-wrapper !w-[260px] !flex !flex-col !gap-4'>
<PopularBrand category={category} />
- {promotionProgram?.data[0]?.map((banner, index)=>(
+ {Array.isArray(promotionProgram?.data) && promotionProgram?.data.length > 0 && promotionProgram?.data[0]?.map((banner, index) => (
<div key={index} className='flex w-60 h-20 object-cover'>
- {/* <Image src='https://erp.indoteknik.com/api/image/x_banner.banner/x_banner_image/397' alt='' width={275} height={4} /> */}
<Image src={`${banner.image}`} alt={`${banner.name}`} width={275} height={4} />
</div>
))}