Update index.tsx
Browse files
src/components/atoms/StatCard/index.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
|
|
| 1 |
"use client";
|
| 2 |
|
| 3 |
import React from "react";
|
|
|
|
| 4 |
|
| 5 |
-
/** Utility to merge
|
| 6 |
function cn(...classes: (string | undefined | false | null)[]) {
|
| 7 |
return classes.filter(Boolean).join(" ");
|
| 8 |
}
|
|
@@ -11,20 +13,15 @@ function cn(...classes: (string | undefined | false | null)[]) {
|
|
| 11 |
export interface StatCardProps {
|
| 12 |
title: string;
|
| 13 |
value: string;
|
| 14 |
-
icon: React.ComponentType<
|
| 15 |
}
|
| 16 |
|
| 17 |
-
/** Standalone StatCard component
|
| 18 |
export const StatCard: React.FC<StatCardProps> = ({ title, value, icon: Icon }) => {
|
| 19 |
return (
|
| 20 |
-
<div
|
| 21 |
-
className={cn(
|
| 22 |
-
"flex items-center gap-4 rounded-lg border p-4 bg-white shadow-sm",
|
| 23 |
-
"transition hover:shadow-md"
|
| 24 |
-
)}
|
| 25 |
-
>
|
| 26 |
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 text-blue-600">
|
| 27 |
-
<Icon size={20} /> {/*
|
| 28 |
</div>
|
| 29 |
<div className="flex flex-col">
|
| 30 |
<span className="text-sm font-medium text-gray-500">{title}</span>
|
|
|
|
| 1 |
+
// src/components/atoms/StatCard/index.tsx
|
| 2 |
"use client";
|
| 3 |
|
| 4 |
import React from "react";
|
| 5 |
+
import { LucideProps } from "lucide-react";
|
| 6 |
|
| 7 |
+
/** Utility to merge class names */
|
| 8 |
function cn(...classes: (string | undefined | false | null)[]) {
|
| 9 |
return classes.filter(Boolean).join(" ");
|
| 10 |
}
|
|
|
|
| 13 |
export interface StatCardProps {
|
| 14 |
title: string;
|
| 15 |
value: string;
|
| 16 |
+
icon: React.ComponentType<LucideProps>; // Works with Lucide icons
|
| 17 |
}
|
| 18 |
|
| 19 |
+
/** Standalone StatCard component */
|
| 20 |
export const StatCard: React.FC<StatCardProps> = ({ title, value, icon: Icon }) => {
|
| 21 |
return (
|
| 22 |
+
<div className={cn("flex items-center gap-4 rounded-lg border p-4 bg-white shadow-sm")}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 text-blue-600">
|
| 24 |
+
<Icon size={20} /> {/* ✅ Works with Lucide icons */}
|
| 25 |
</div>
|
| 26 |
<div className="flex flex-col">
|
| 27 |
<span className="text-sm font-medium text-gray-500">{title}</span>
|