19 lines
381 B
TypeScript
19 lines
381 B
TypeScript
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>;
|
|
}
|