PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.3
Yatra – Travel Booking & Tour Operator Software v3.0.3
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / resources / js / components / common / StatCard.tsx

StatCard.tsx in Yatra – Travel Booking & Tour Operator Software 3.0.3, at resources/js/components/common/StatCard.tsx

78 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Stat Card Component
3 * Ultra-minimal SaaS-style stat card
4 */
5
6 import React from "react";
7 import { LucideIcon } from "lucide-react";
8
9 interface StatCardProps {
10 title: string;
11 value: string | number;
12 icon: LucideIcon;
13 trend?: {
14 value: number;
15 isPositive: boolean;
16 };
17 color?: "blue" | "green" | "purple" | "orange";
18 loading?: boolean;
19 }
20
21 /**
22 * Stat Card Component - Ultra minimal design
23 */
24 export const StatCard: React.FC<StatCardProps> = ({
25 title,
26 value,
27 icon: Icon,
28 trend,
29 color = "blue",
30 loading = false,
31 }) => {
32 return (
33 <div className="bg-white dark:bg-gray-800 rounded-lg border border-gray-100 dark:border-gray-700/50 p-3 hover:border-gray-200 dark:hover:border-gray-600 transition-colors">
34 <div className="flex items-start justify-between">
35 <div className="flex-1">
36 <p className="text-xs text-gray-500 dark:text-gray-400 mb-1">
37 {title}
38 </p>
39 {loading ? (
40 <div className="h-6 w-20 bg-gray-100 dark:bg-gray-700 rounded animate-pulse" />
41 ) : (
42 <p className="text-xl font-semibold text-gray-900 dark:text-white">
43 {value}
44 </p>
45 )}
46 {trend && !loading && (
47 <div className="flex items-center gap-1 mt-2">
48 <span
49 className={`text-xs font-medium ${trend.isPositive ? "text-green-600 dark:text-green-400" : "text-red-600 dark:text-red-400"}`}
50 >
51 {trend.isPositive ? "" : ""} {Math.abs(trend.value)}%
52 </span>
53 <span className="text-xs text-gray-400 dark:text-gray-500">
54 vs last month
55 </span>
56 </div>
57 )}
58 </div>
59 <div className={`p-2.5 rounded-lg bg-gray-50 dark:bg-gray-700/50`}>
60 <Icon
61 className={`w-4 h-4 ${
62 color === "blue"
63 ? "text-blue-600 dark:text-blue-400"
64 : color === "green"
65 ? "text-green-600 dark:text-green-400"
66 : color === "purple"
67 ? "text-purple-600 dark:text-purple-400"
68 : "text-orange-600 dark:text-orange-400"
69 }`}
70 />
71 </div>
72 </div>
73 </div>
74 );
75 };
76
77 export default StatCard;
78