praven2's picture
Create a app using vite react js and show dashboard screen
e01e648 verified
raw
history blame contribute delete
903 Bytes
javascript
const StatsCard = ({ title, value, icon, trend, percentage }) => {
return (
<div className="bg-white rounded-lg shadow p-6">
<div className="flex justify-between items-start">
<div>
<p className="text-sm font-medium text-gray-500">{title}</p>
<h3 className="text-2xl font-bold text-gray-800 mt-1">{value}</h3>
</div>
<div className="p-3 rounded-full bg-indigo-100 text-indigo-600">
<i data-feather={icon} className="w-5 h-5"></i>
</div>
</div>
{trend && (
<div className={`mt-3 flex items-center text-sm ${trend === 'up' ? 'text-green-600' : 'text-red-600'}`}>
<i data-feather={trend === 'up' ? 'trending-up' : 'trending-down'} className="w-4 h-4 mr-1"></i>
<span>{percentage}% vs last period</span>
</div>
)}
</div>
);
};
export default StatsCard;
</html>