-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDashboardCard.tsx
More file actions
33 lines (29 loc) · 1.02 KB
/
DashboardCard.tsx
File metadata and controls
33 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
interface DashboardCardProps {
title: string;
value: string | number;
icon: React.ReactNode;
change?: string;
changeType?: 'positive' | 'negative';
}
export const DashboardCard: React.FC<DashboardCardProps> = ({ title, value, icon, change, changeType }) => {
const changeColor = changeType === 'positive' ? 'text-green-400' : 'text-red-400';
return (
<div className="bg-surface rounded-lg p-6 shadow-lg flex-1">
<div className="flex justify-between items-start">
<div className="flex flex-col">
<p className="text-sm text-text-secondary uppercase tracking-wider">{title}</p>
<p className="text-3xl font-bold text-text-primary mt-1">{typeof value === 'number' ? `$${value.toLocaleString()}` : value}</p>
</div>
<div className="bg-gray-800 p-3 rounded-full">
{icon}
</div>
</div>
{change && (
<p className={`text-sm mt-2 ${changeColor}`}>
{change} vs last month
</p>
)}
</div>
);
};