From 212fda06b5b956e9908c6eb83864990dd589ca8e Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 4 Sep 2024 11:07:52 +0700
Subject: <iman> update mobile view category

---
 src/core/components/elements/Sidebar/Sidebar.jsx | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

(limited to 'src/core/components/elements/Sidebar/Sidebar.jsx')

diff --git a/src/core/components/elements/Sidebar/Sidebar.jsx b/src/core/components/elements/Sidebar/Sidebar.jsx
index 55838890..d9c2c533 100644
--- a/src/core/components/elements/Sidebar/Sidebar.jsx
+++ b/src/core/components/elements/Sidebar/Sidebar.jsx
@@ -5,6 +5,8 @@ import { AnimatePresence, motion } from 'framer-motion'
 import { ChevronDownIcon, ChevronUpIcon, CogIcon, UserIcon } from '@heroicons/react/24/outline'
 import { Fragment, useEffect, useState } from 'react'
 import odooApi from '@/core/api/odooApi'
+import { createSlug } from '@/core/utils/slug'
+import Image from 'next/image'
 
 const Sidebar = ({ active, close }) => {
   const auth = useAuth()
@@ -155,9 +157,12 @@ const Sidebar = ({ active, close }) => {
                     <Fragment key={category.id}>
                       <div className='flex w-full text-gray_r-11 border-b border-gray_r-6 px-4 pl-8 items-center'>
                         <Link
-                          href={`/shop/search?category=${category.name}`}
-                          className='flex-1 font-normal !text-gray_r-11 py-4'
+                          href={createSlug('/shop/category/', category.name, category.id)}
+                          className='flex-1 font-normal !text-gray_r-11 py-4 flex items-center flex-row'
                         >
+                          <div className='mr-2  flex justify-center items-center'>
+                            <Image src={category.image} alt='' width={25} height={25} />
+                          </div>
                           {category.name}
                         </Link>
                         <div
@@ -177,9 +182,12 @@ const Sidebar = ({ active, close }) => {
                               }`}
                             >
                               <Link
-                                href={`/shop/search?category=${child1Category.name}`}
-                                className='flex-1 font-normal !text-gray_r-11'
+                                href={createSlug('/shop/category/', child1Category.name, child1Category.id)}
+                                className='flex-1 font-normal !text-gray_r-11 flex flex-row items-center'
                               >
+                                <div className='mr-2  flex justify-center items-center'>
+                                  <Image src={`https://erp.indoteknik.com/api/image/product.public.category/image_1920/${child1Category.id}`} alt='' width={25} height={25} />
+                                </div>
                                 {child1Category.name}
                               </Link>
                               {child1Category.childs.length > 0 && (
@@ -200,9 +208,12 @@ const Sidebar = ({ active, close }) => {
                               child1Category.childs.map((child2Category) => (
                                 <Link
                                   key={child2Category.id}
-                                  href={`/shop/search?category=${child2Category.name}`}
-                                  className='flex w-full font-normal !text-gray_r-11 border-b border-gray_r-6 p-4 pl-16'
+                                  href={createSlug('/shop/category/', child2Category.name, child2Category.id)}
+                                  className='flex w-full font-normal !text-gray_r-11 border-b border-gray_r-6 p-4 pl-16 flex-row'
                                 >
+                                  <div className='mr-2  flex justify-center items-center'>
+                                    <Image src={`https://erp.indoteknik.com/api/image/product.public.category/image_1920/${child2Category.id}`} alt='' width={25} height={25} />
+                                  </div>
                                   {child2Category.name}
                                 </Link>
                               ))}
-- 
cgit v1.2.3

