'use client'; import Link from 'next/link'; import Image from 'next/image'; import { motion } from 'framer-motion'; import { useState, useEffect } from 'react'; interface CompetenceBentoGridProps { badge?: string; title?: string; ctaLabel?: string; ctaHref?: string; items?: { title?: string; description?: string; tag?: string; image?: { url?: string; alt?: string; } | any; size?: 'large' | 'medium' | 'small' | 'accent'; }[]; data?: { badge?: string; title?: string; ctaLabel?: string; ctaHref?: string; items?: { title?: string; description?: string; tag?: string; image?: { url?: string; alt?: string; } | any; size?: 'large' | 'medium' | 'small' | 'accent'; }[]; }; } export function CompetenceBentoGrid(props: CompetenceBentoGridProps) { const { data } = props; const [isMounted, setIsMounted] = useState(false); useEffect(() => { setIsMounted(true); }, []); const badge = props.badge || data?.badge || 'Leistungsspektrum'; const title = props.title || data?.title || 'Umfassende Lösungen für komplexe Netzwerke'; const ctaLabel = props.ctaLabel || data?.ctaLabel || 'Alle Kompetenzen ansehen'; const ctaHref = props.ctaHref || data?.ctaHref || '/kompetenzen'; const items = props.items || data?.items || []; // Static fallback for SSR if (!isMounted) { return ( {badge} {title} {/* Simplified static grid */} ); } return ( {badge} {title} {ctaLabel} {items.map((item, idx) => { const isLarge = item.size === 'large'; const isMedium = item.size === 'medium'; const isAccent = item.size === 'accent'; const imgSrc = item.image?.url; let gridClasses = "rounded-2xl overflow-hidden relative group "; if (isLarge) gridClasses += "md:col-span-2 md:row-span-2"; else if (isMedium) gridClasses += "md:col-span-2 lg:col-span-2"; else if (isAccent) gridClasses += "md:col-span-1 bg-primary text-white p-6 md:p-8 flex flex-col justify-center border-none shadow-md"; else gridClasses += "md:col-span-1"; if (isAccent) { return ( {item.title} {item.description && {item.description}} ); } return ( {!imgSrc && ( )} {imgSrc && ( <> > )} {item.tag && ( {item.tag} )} {item.title} {item.description && ( {item.description} )} ); })} ); }
{item.description}