import styles from "./capacity.module.css"; interface Props { value?: number; limit?: number; color?: string; } const CYAN = "var(--geist-cyan-light)"; const WARNING = "var(--geist-warning)"; const RED = "var(--geist-error-dark)"; function clamp(val: number, min: number, max: number) { return Math.min(Math.max(val, min), max); } const Capacity: React.ComponentType = ({ value, limit, color }) => { const percentage = value / limit; const width = clamp(percentage * 50, 8, 50); if (!color) { color = percentage >= 0.66 ? RED : percentage >= 0.33 ? WARNING : CYAN; } return (
); }; export default Capacity;