'use client' import React, { useEffect, useRef, useState } from 'react' import type { FDStatisticsBlock as Props } from '@/payload-types' export const FDStatisticsBlockComponent: React.FC = ({ title, stats = [], sectionBackground = 'white', numberColor = 'gradient', }) => { const [visible, setVisible] = useState(false) const ref = useRef(null) useEffect(() => { const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) setVisible(true) }, { threshold: 0.3 }, ) if (ref.current) observer.observe(ref.current) return () => observer.disconnect() }, []) const bgClass = sectionBackground === 'navy' ? 'bg-fd-navy' : sectionBackground === 'gray' ? 'bg-fd-surface-alt' : 'bg-white' const titleClass = sectionBackground === 'navy' ? 'text-fd-yellow' : 'text-fd-navy' const labelClass = sectionBackground === 'navy' ? 'text-white' : 'text-fd-navy' const getNumberClass = () => { if (numberColor === 'gradient') return 'bg-gradient-to-r from-fd-yellow to-fd-mint bg-clip-text text-transparent' if (numberColor === 'yellow') return 'text-fd-yellow' if (numberColor === 'mint') return 'text-fd-mint' if (numberColor === 'white') return 'text-white' return 'text-fd-navy' } return (
{title && (

{title}

)}
{(stats ?? []).map((stat, i) => (
{/* Intentionally oversized for visual impact — not mapped to fd-* token */} {stat.number} {stat.label}
))}
) }