"use client"; import Image from "next/image"; import Link from "next/link"; import { Card, CardContent } from "@/components/ui/card"; import type { Category } from "@/lib/types/api"; import { Skeleton } from "@/components/ui/skeleton"; type Props = { categories: Category[] | undefined; isLoading: boolean; isError: boolean; locale: string; title: string; }; export default function CategoryGrid({ categories, isLoading, isError, locale, title, }: Props) { if (isError) { return (

{title}

Failed to load categories. Please try again.

); } if (isLoading) { return (

{title}

{Array.from({ length: 10 }).map((_, i) => (
))}
); } return (

{title}

{categories?.map((cat) => (
{cat.name}

{cat.name}

))}
); }