import { cn } from '@/lib/utils'; import { useEffect, useState } from 'react'; interface LedDisplayProps { value: number; className?: string; animate?: boolean; onClick?: () => void; } export default function LedDisplay({ value, className, onClick }: LedDisplayProps) { const [displayValue, setDisplayValue] = useState(0); // Animate number changes useEffect(() => { setDisplayValue(value); return; }, [value]); // Format number with zero-padding for consistent width const formatValue = (value: number) => { // Always pad to 5 digits for consistent display width const integerPart = Math.floor(value); return integerPart.toString().padStart(5, '0'); }; const formattedValue = formatValue(displayValue); return (
{formattedValue}
); }