import { useEffect, useRef, useState } from 'react' import { statsData, serviceListData, commonDescriptions } from '../../data/siteData' function useCountUp(end: number, duration: number = 2000, startCounting: boolean = false) { const [count, setCount] = useState(0) useEffect(() => { if (!startCounting) return let startTime: number let animationFrame: number const animate = (currentTime: number) => { if (!startTime) startTime = currentTime const progress = Math.min((currentTime - startTime) / duration, 1) setCount(Math.floor(progress * end)) if (progress < 1) { animationFrame = requestAnimationFrame(animate) } } animationFrame = requestAnimationFrame(animate) return () => cancelAnimationFrame(animationFrame) }, [end, duration, startCounting]) return count } function StatItem({ value, label, startCounting }: { value: number; label: string; startCounting: boolean }) { const count = useCountUp(value, 2000, startCounting) return (
{commonDescriptions.sectionDesc}
{commonDescriptions.statsDesc}
{commonDescriptions.statsDesc2}
{/* Stats Grid */}{service.description}