-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatCard.jsx
More file actions
83 lines (76 loc) · 2.48 KB
/
StatCard.jsx
File metadata and controls
83 lines (76 loc) · 2.48 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { motion } from 'framer-motion'
import PropTypes from 'prop-types'
import Icon from './Icon'
const StatCard = ({ label, value, delta, icon, color = '#00e5a0', subtext }) => (
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
whileHover={{ y: -1 }}
transition={{ duration: 0.2 }}
className="relative overflow-hidden rounded-2xl p-5 flex flex-col gap-4"
style={{
background: 'rgba(255,255,255,0.025)',
border: '1px solid rgba(255,255,255,0.06)',
}}
>
{/* Subtle glow bleed top-right */}
<div
className="absolute top-0 right-0 w-28 h-28 rounded-full pointer-events-none"
style={{ background: color, opacity: 0.04, filter: 'blur(32px)', transform: 'translate(30%, -30%)' }}
/>
{/* Label + icon row */}
<div className="flex items-center justify-between">
<span
className="text-[10px] font-semibold tracking-[0.12em] uppercase text-white/35"
style={{ fontFamily: "'DM Mono', 'IBM Plex Mono', monospace" }}
>
{label}
</span>
<div
className="w-7 h-7 rounded-lg flex items-center justify-center"
style={{ background: `${color}12`, border: `1px solid ${color}22` }}
>
<span style={{ color }}>
<Icon name={icon} size={13} />
</span>
</div>
</div>
{/* Value + delta */}
<div className="flex items-end gap-3">
<span className="text-3xl font-bold text-white tracking-tight leading-none">{value}</span>
{delta && (
<span
className={`text-[11px] font-semibold mb-0.5 tabular-nums ${
delta.startsWith('+') ? 'text-emerald-400' : 'text-red-400'
}`}
style={{ fontFamily: "'DM Mono', 'IBM Plex Mono', monospace" }}
>
{delta}
</span>
)}
</div>
{/* Subtext */}
{subtext && (
<span
className="text-[10px] text-white/25 tracking-wide"
style={{ fontFamily: "'DM Mono', 'IBM Plex Mono', monospace" }}
>
{subtext}
</span>
)}
{/* Bottom rule accent */}
<div
className="absolute bottom-0 left-5 right-5 h-px"
style={{ background: `linear-gradient(to right, ${color}00, ${color}30, ${color}00)` }}
/>
</motion.div>
)
StatCard.propTypes = {
label: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
delta: PropTypes.string,
icon: PropTypes.string.isRequired,
color: PropTypes.string,
subtext: PropTypes.string,
}
export default StatCard