-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatBlock.tsx
More file actions
51 lines (48 loc) · 1.72 KB
/
StatBlock.tsx
File metadata and controls
51 lines (48 loc) · 1.72 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
'use client';
import { cn } from '@/lib/utils';
import type { StatBlockProps } from './StatBlock.types';
/**
* StatBlock Component - Horizontal Stat Row
* Neo-Brutalist stat display for surfacing key metrics
* Uses thick borders, secondary accents, and monospace typography
*/
export function StatBlock({ stats, title, className }: StatBlockProps) {
return (
<div
className={cn(
'my-8 overflow-hidden rounded-none border-[4px] border-foreground bg-bg-elevated shadow-[8px_8px_0px_0px] shadow-black',
className
)}
>
{/* Header */}
{title && (
<div className="border-b-[4px] border-foreground bg-secondary px-4 py-2">
<span className="font-mono text-[10px] font-bold text-secondary-text uppercase tracking-widest">
{title}
</span>
</div>
)}
{/* Stats Grid */}
<div
className={cn(
'grid divide-y-[3px] sm:divide-y-0 sm:divide-x-[3px] divide-foreground',
stats.length <= 2 && 'sm:grid-cols-2',
stats.length === 3 && 'sm:grid-cols-3',
stats.length >= 4 && 'grid-cols-2 sm:grid-cols-4'
)}
>
{stats.map((stat, index) => (
<div key={index} className="flex flex-col items-center justify-center px-4 py-4 sm:py-6">
{stat.icon && <span className="mb-1 text-lg">{stat.icon}</span>}
<span className="font-mono text-2xl sm:text-3xl font-black text-foreground leading-none">
{stat.value}
</span>
<span className="mt-1.5 font-mono text-[10px] sm:text-xs font-bold uppercase tracking-widest text-muted">
{stat.label}
</span>
</div>
))}
</div>
</div>
);
}