"use client"; import Image from "next/image"; import { icons } from "lucide-react"; import { SectionHeading } from "@/components/ui/SectionHeading"; import { Reveal } from "@/components/ui/Reveal"; import { ShowcaseLayout } from "@/components/ui/ShowcaseLayout"; import { useShowcaseRotation } from "@/hooks/useShowcaseRotation"; import type { ClassItem, SiteContent } from "@/types"; import { UI_CONFIG } from "@/lib/config"; // kebab "heart-pulse" → PascalCase "HeartPulse" function toPascal(kebab: string) { return kebab.split("-").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(""); } function getIcon(key: string) { const Icon = icons[toPascal(key) as keyof typeof icons]; return Icon ? : null; } interface ClassesProps { data: SiteContent["classes"]; } export function Classes({ data: classes }: ClassesProps) { const { activeIndex, select, setHovering } = useShowcaseRotation({ totalItems: classes.items.length, autoPlayInterval: UI_CONFIG.showcase.autoPlayInterval, }); return ( {classes.title} items={classes.items} activeIndex={activeIndex} onSelect={select} onHoverChange={setHovering} renderDetail={(item) => ( {/* Hero image */} {item.images && item.images[0] && ( {/* Gradient overlay */} {/* Icon + name overlay */} {getIcon(item.icon)} {item.name} )} {/* Description */} {item.detailedDescription && ( {item.detailedDescription} )} )} renderSelectorItem={(item, _i, isActive) => ( {/* Icon */} {getIcon(item.icon)} {item.name} {item.description} )} /> ); }
{item.name}
{item.description}