import { useCountUp } from "@/hooks/useCountUp";

interface AnimatedNumberProps {
  value: number;
  format: (n: number) => string;
  duration?: number;
  className?: string;
}

export function AnimatedNumber({
  value,
  format,
  duration,
  className,
}: AnimatedNumberProps) {
  const n = useCountUp(value, duration);
  return <span className={className}>{format(n)}</span>;
}
