import { getCmsImageUrl } from '@/utils/image'; import Link from 'next/link'; interface HeroSlide { title: string; subtitle: string; description: string; primaryButton: { label: string; href: string; }; secondaryButton: { label: string; href: string; }; heroImage?: string; videoUrl: string; } interface HeroSectionProps { data: { backgroundImage: string; // Optional multi-slide support from CMS slides?: HeroSlide[]; // Legacy single-slide fields (fallback) title?: string; subtitle?: string; description?: string; primaryButton?: { label: string; href: string; }; secondaryButton?: { label: string; href: string; }; heroImage?: string; videoUrl?: string; }; } const HeroSection = ({ data }: HeroSectionProps) => { const slides: HeroSlide[] = (data.slides && data.slides.length > 0) ? data.slides : [{ title: data.title || '', subtitle: data.subtitle || '', description: data.description || '', primaryButton: data.primaryButton || { label: '', href: '#' }, secondaryButton: data.secondaryButton || { label: '', href: '#' }, heroImage: data.heroImage, videoUrl: data.videoUrl || '', }]; const firstSlide = slides[0]; return (
img
img
img
img
03 05
{slides.map((slide, index) => (
{slide.subtitle}

{slide.title} {slide.videoUrl && ( )}

{slide.description}

{slide.primaryButton?.href && ( {slide.primaryButton.label} )} {slide.secondaryButton?.href && ( {slide.secondaryButton.label} )}
))}
{slides.map((slide, index) => (
img
))}
); }; export default HeroSection;