"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"; import { ChevronRight } from "lucide-react"; type Props = { categories: Category[] | undefined; isLoading: boolean; isError: boolean; locale: string; title: string; showAllOnMobile?: boolean; }; export default function CategoryGrid({ categories, isLoading, isError, locale, title, showAllOnMobile = false, }: Props) { if (isError) { return (

{title}

Failed to load categories

Please refresh the page and try again

); } if (isLoading) { return (
{Array.from({ length: 12 }).map((_, i) => (
= 2 ? "hidden sm:block" : ""}`}>
))}
); } return (

{title}

{!showAllOnMobile && ( )}
{categories?.map((cat, index) => ( = 2 ? "hidden sm:block" : ""}`} >
{cat.name}

{cat.name}

))}
); }