Create frontend/src/components/admin/OverviewCard.jsx
Browse files
frontend/src/components/admin/OverviewCard.jsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// frontend/src/components/admin/OverviewCard.jsx
|
| 2 |
+
import React from "react";
|
| 3 |
+
|
| 4 |
+
const colorMap = {
|
| 5 |
+
blue: "bg-blue-50 text-blue-700",
|
| 6 |
+
amber: "bg-amber-50 text-amber-700",
|
| 7 |
+
red: "bg-red-50 text-red-700",
|
| 8 |
+
green: "bg-emerald-50 text-emerald-700",
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default function OverviewCard({ title, value, icon: Icon, color, trend }) {
|
| 12 |
+
const badgeClasses = colorMap[color] || "bg-slate-50 text-slate-700";
|
| 13 |
+
|
| 14 |
+
return (
|
| 15 |
+
<div className="bg-white border border-stone-200 rounded-2xl p-4 shadow-sm flex flex-col justify-between">
|
| 16 |
+
<div className="flex items-start justify-between gap-3">
|
| 17 |
+
<div>
|
| 18 |
+
<div className="text-xs font-medium text-stone-500 uppercase tracking-wide mb-1">
|
| 19 |
+
{title}
|
| 20 |
+
</div>
|
| 21 |
+
<div className="text-2xl font-semibold text-stone-900">
|
| 22 |
+
{value ?? 0}
|
| 23 |
+
</div>
|
| 24 |
+
</div>
|
| 25 |
+
{Icon && (
|
| 26 |
+
<div
|
| 27 |
+
className={`inline-flex items-center justify-center w-9 h-9 rounded-full text-xs font-medium ${badgeClasses}`}
|
| 28 |
+
>
|
| 29 |
+
<Icon className="w-4 h-4" />
|
| 30 |
+
</div>
|
| 31 |
+
)}
|
| 32 |
+
</div>
|
| 33 |
+
{trend && (
|
| 34 |
+
<div className="mt-3 text-xs text-stone-500">
|
| 35 |
+
{trend}
|
| 36 |
+
</div>
|
| 37 |
+
)}
|
| 38 |
+
</div>
|
| 39 |
+
);
|
| 40 |
+
}
|