'use client'; import * as React from 'react'; import { m, LazyMotion, domAnimation } from 'framer-motion'; import Link from 'next/link'; import Image from 'next/image'; import { HoverShineOverlay } from '@/components/ui/HoverShineOverlay'; import { useTranslations, useLocale } from 'next-intl'; export interface Reference { id: string; title: string; slug: string; category: string; image?: { url: string; alt?: string; } | string | null; } interface ReferencesSliderProps { references?: Reference[]; badge?: string; title?: string; description?: string; ctaLabel?: string; ctaHref?: string; data?: { badge?: string; title?: string; description?: string; ctaLabel?: string; ctaHref?: string; } } export function ReferencesSlider(props: ReferencesSliderProps) { const t = useTranslations('ReferencesSlider'); const locale = useLocale(); const { data } = props; const references = props.references || []; const badge = props.badge || data?.badge || t('badge'); const title = props.title || data?.title || t('title'); const description = props.description || data?.description || t('description'); const ctaLabel = props.ctaLabel || data?.ctaLabel || t('ctaLabel'); const ctaHref = props.ctaHref || data?.ctaHref || `/${locale}/referenzen`; if (!references || references.length === 0) return null; // Fallback images pool if CMS doesn't provide one const fallbacks = [ '/assets/photos/DSC01123.JPG', '/assets/photos/DSC00850.JPG', '/assets/photos/DSC01129.JPG', '/assets/photos/DSC00010.JPG', ]; return (

{badge}

{title}

{description}
{references.map((ref, i) => { const imgSrc = ref.image ? (typeof ref.image === 'string' ? ref.image : ref.image.url) : fallbacks[i % fallbacks.length]; return ( {ref.title}
{ref.category}

{ref.title}

); })}
{ctaLabel}
); }