2024-03-13 17:01:23 +00:00
|
|
|
import { AddIcon } from "./icons";
|
2024-03-12 20:22:54 +00:00
|
|
|
import { Button } from "./ui/button";
|
|
|
|
import { Progress } from "./ui/progress";
|
|
|
|
|
|
|
|
interface UsageCardProps {
|
2024-03-13 17:01:23 +00:00
|
|
|
label: string,
|
2024-03-12 20:22:54 +00:00
|
|
|
monthlyUsage: number, // Asumming that the minimium is 1GB
|
|
|
|
currentUsage: number,
|
2024-03-14 01:50:32 +00:00
|
|
|
icon: React.ReactNode,
|
|
|
|
button?: React.ReactNode;
|
2024-03-12 20:22:54 +00:00
|
|
|
}
|
|
|
|
|
2024-03-14 01:50:32 +00:00
|
|
|
export const UsageCard = ({ label, monthlyUsage, currentUsage, icon, button }: UsageCardProps) => {
|
2024-03-12 20:22:54 +00:00
|
|
|
return (
|
|
|
|
<div className="p-8 border rounded-lg w-full">
|
|
|
|
<div className="flex items-center justify-between mb-8">
|
|
|
|
<div className="text-primary-2 text-sm">
|
|
|
|
<div className="flex items-center gap-x-2 text-lg font-bold text-white mb-2">
|
|
|
|
{icon}
|
2024-03-13 17:01:23 +00:00
|
|
|
{label}
|
2024-03-12 20:22:54 +00:00
|
|
|
</div>
|
2024-03-13 17:01:23 +00:00
|
|
|
Montly {label.toLocaleLowerCase()} limit is {monthlyUsage} GB
|
2024-03-12 20:22:54 +00:00
|
|
|
</div>
|
2024-03-14 01:50:32 +00:00
|
|
|
{!button ? (
|
|
|
|
<Button className="gap-x-2 h-12">
|
|
|
|
<AddIcon />
|
|
|
|
Add More
|
|
|
|
</Button>
|
|
|
|
) : (
|
|
|
|
button
|
|
|
|
)}
|
2024-03-12 20:22:54 +00:00
|
|
|
</div>
|
|
|
|
<Progress max={monthlyUsage} value={currentUsage} />
|
2024-03-13 17:01:23 +00:00
|
|
|
<div className="flex items-center justify-between mt-4 font-semibold text-sm">
|
2024-03-12 20:22:54 +00:00
|
|
|
<span className="text-primary-2">{currentUsage} GB used</span>
|
|
|
|
<span className="text-white">{monthlyUsage - currentUsage} GB left</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
2024-03-14 01:50:32 +00:00
|
|
|
}
|