'use client'; import * as React from 'react'; import { motion } from 'framer-motion'; import Link from 'next/link'; import Image from 'next/image'; 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 { data } = props; const references = props.references || []; const containerRef = React.useRef(null); const badge = props.badge || data?.badge || 'Ausgewählte Projekte'; const title = props.title || data?.title || 'Referenzen & Erfolge'; const description = props.description || data?.description || 'Ein Auszug unserer erfolgreich abgeschlossenen Projekte im Bereich Kabeltiefbau, Bohrtechnik und Netzinfrastruktur.'; const ctaLabel = props.ctaLabel || data?.ctaLabel || 'Alle Referenzen ansehen'; const ctaHref = props.ctaHref || data?.ctaHref || '/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 === 'object' && ref.image.url) ? ref.image.url : fallbacks[i % fallbacks.length]; return (
{ref.title}
{ref.category}

{ref.title}

); })}
{ctaLabel}
); }