import clsx from 'clsx' interface FuelGaugeProps { value: number // 0-100 maxValue?: number label?: string size?: 'sm' | 'md' | 'lg' showPercentage?: boolean className?: string } export default function FuelGauge({ value, maxValue = 100, label = 'Combustible', size = 'md', showPercentage = true, className, }: FuelGaugeProps) { const percentage = Math.min(100, Math.max(0, (value / maxValue) * 100)) // Color based on level const getColor = () => { if (percentage <= 20) return { bg: 'bg-error-500', text: 'text-error-400' } if (percentage <= 40) return { bg: 'bg-warning-500', text: 'text-warning-400' } return { bg: 'bg-success-500', text: 'text-success-400' } } const colors = getColor() const sizeStyles = { sm: { height: 'h-2', text: 'text-xs', icon: 'w-4 h-4' }, md: { height: 'h-3', text: 'text-sm', icon: 'w-5 h-5' }, lg: { height: 'h-4', text: 'text-base', icon: 'w-6 h-6' }, } const styles = sizeStyles[size] return (
{percentage.toFixed(0)}%
{label &&{label}
}