true message
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface CapacityProgressBarProps {
|
||||
current: number;
|
||||
max: number;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function CapacityProgressBar({ current, max, className }: CapacityProgressBarProps) {
|
||||
const percentage = max > 0 ? (current / max) * 100 : 0;
|
||||
|
||||
// Définir la couleur en fonction du taux de remplissage
|
||||
const getColorClass = () => {
|
||||
if (percentage >= 90) return "bg-red-500";
|
||||
if (percentage >= 70) return "bg-orange-500";
|
||||
return "bg-green-500";
|
||||
};
|
||||
|
||||
const getTextColorClass = () => {
|
||||
if (percentage >= 90) return "text-red-700";
|
||||
if (percentage >= 70) return "text-orange-700";
|
||||
return "text-green-700";
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={cn("space-y-1", className)}>
|
||||
<div className="flex items-center justify-between text-sm gap-4">
|
||||
<span className={cn("font-medium", getTextColorClass())}>
|
||||
{current} / {max}
|
||||
</span>
|
||||
<span className={cn("text-xs", getTextColorClass())}>
|
||||
{Math.round(percentage)}%
|
||||
</span>
|
||||
</div>
|
||||
<Progress
|
||||
value={percentage}
|
||||
className="h-2"
|
||||
indicatorClassName={getColorClass()}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user