'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import Image from 'next/image'; import { ArrowRight, Folder } from 'lucide-react'; import { catalogService, CategoryResponse } from '@/services/api/catalogService'; export function CategoryGrid() { const [categories, setCategories] = useState([]); useEffect(() => { catalogService.getCategories().then((res) => { if (Array.isArray(res)) setCategories(res.slice(0, 6)); }); }, []); if (categories.length === 0) return null; return (
{/* Header */}

Shop By Categories

View All
{/* Category Cards Grid */}
{categories.map((cat) => (
{cat.image_url ? ( {cat.name} ) : ( )}

{cat.name}

{cat.product_count ? `${cat.product_count} Products` : 'Explore Category'} ))}
); }