summaryrefslogtreecommitdiff
path: root/src/lib/product/components/CategorySection.jsx
blob: 4c66e8614f563eba40c4f1e5f2f91b169f58002b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import Image from "next/image"
import Link from 'next/link'
import { createSlug } from '@/core/utils/slug'

const CategorySection = ({ categories }) => {
    return (
        <section>
            <div className="group/item grid grid-cols-5 gap-y-2 gap-x-2 w-full h-full col-span-2 ">
                {categories.map((category) => (
                    <Link href={createSlug('/shop/category/', category?.name, category?.id)} key={category?.id} passHref>
                        <div className="group transition-colors duration-300">
                            <div className="KartuInti h-18 w-26 max-w-sm lg:max-w-full flex flex-col border-[2px] border-gray-200 group-hover:border-red-400 rounded relative ">
                                <div className="flex items-center justify-center h-full px-1 flex-row">
                                    <Image className="" src='https://erp.indoteknik.com/api/image/product.template/image_256/544371?ratio=square' width={56} height={48} alt={category?.name} />
                                    <h2 className="text-gray-700 group-hover:text-[#E20613] line-clamp-2 content-center  h-fit w-60 px-1 font-semibold text-sm text-start">{category?.name}</h2>
                                </div>
                            </div>
                        </div>
                    </Link>
                ))}
            </div>
        </section>
    )
}

export default CategorySection