"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 refresh the page and try again ); } if (isLoading) { return ( {Array.from({ length: 12 }).map((_, i) => ( ))} ); } return ( {title} {categories?.map((cat) => ( {cat.name} ))} ); }
Failed to load categories
Please refresh the page and try again
{cat.name}