"use client"; import { useState, type CSSProperties } from "react"; import { CATEGORIES } from "@/lib/ui-config"; import type { CategoryId } from "@/lib/types"; import { Icons } from "./icons"; export function CategoryTile({ category, size = "sm", }: { category: CategoryId; size?: "sm" | "md" | "lg"; }) { const cat = CATEGORIES[category] || CATEGORIES.other; const Icon = Icons[cat.icon as keyof typeof Icons]; const iconSize = { sm: 22, md: 28, lg: 40 }[size]; return (
); } export function CoverImage({ src, alt, category, style, }: { src?: string | null; alt?: string; category: CategoryId; style?: CSSProperties; }) { const [err, setErr] = useState(false); if (!src || err) { return (
); } return ( // eslint-disable-next-line @next/next/no-img-element {alt} setErr(true)} style={{ objectFit: "cover", ...style }} /> ); }