"use client" import Image from "next/image" import Link from "next/link" import { Card, CardContent } from "@/components/ui/card" import { Skeleton } from "@/components/ui/skeleton" import type { Category } from "@/lib/types/api" 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: 6 }).map((_, i) => ( ))} ) } return ( {title} {categories?.map((cat) => ( {cat.name} ))} ) }
Failed to load categories. Please try again.
{cat.name}