import React, { useEffect, useState } from "react"; import { Box, Grid, Typography } from "@mui/material"; import { motion, useAnimation } from "framer-motion"; import { useInView } from "react-intersection-observer"; import darkbackground from "../../../dark-background.jpg" // Counter Component const Counter = ({ target, label, icon }: { target: number; label: string; icon: React.ReactNode }) => { const controls = useAnimation(); const [count, setCount] = useState(0); const { ref, inView } = useInView({ triggerOnce: true }); useEffect(() => { if (inView) { let start = 0; const step = Math.ceil(target / 50); const interval = setInterval(() => { start += step; setCount(start > target ? target : start); if (start >= target) clearInterval(interval); }, 20); } }, [inView, target]); return ( {icon} {label} {count} ); }; const StatsSection = () => { return ( {/* Coffee Cups */} ☕} /> {/* Projects */} 💼} /> {/* Working Days */} 🖱️} /> {/* Clients */} 👥} /> ); }; export default StatsSection;