Files
gridpilot.gg/apps/website/components/drivers/DriverStatsPanel.tsx
Marc Mintel e04282d77e
Some checks failed
CI / lint-typecheck (pull_request) Failing after 10s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
code quality
2026-01-27 17:36:39 +01:00

46 lines
1.6 KiB
TypeScript

'use client';
import { Box } from '@/ui/Box';
import { Text } from '@/ui/Text';
interface StatItem {
label: string;
value: string | number;
subValue?: string;
color?: string;
}
interface DriverStatsPanelProps {
stats: StatItem[];
}
export function DriverStatsPanel({ stats }: DriverStatsPanelProps) {
return (
<Box data-testid="driver-stats-panel-grid" display="grid" gridCols={{ base: 2, sm: 3, lg: 6 }} gap="px" overflow="hidden" rounded="xl" border borderColor="border-charcoal-outline" bg="bg-charcoal-outline">
{stats.map((stat, index) => (
<Box key={index} data-testid={`stat-item-${stat.label.toLowerCase().replace(/\s+/g, '-')}`} display="flex" flexDirection="col" gap={1} bg="bg-deep-charcoal" p={5} transition hoverBg="bg-deep-charcoal/80">
<Text data-testid={`stat-label-${stat.label.toLowerCase().replace(/\s+/g, '-')}`} size="xs" weight="bold" color="text-gray-500" uppercase letterSpacing="wider">
{stat.label}
</Text>
<Box display="flex" alignItems="baseline" gap={1.5}>
<Text
data-testid={`stat-value-${stat.label.toLowerCase().replace(/\s+/g, '-')}`}
size="2xl"
weight="bold"
font="mono"
color={stat.color || 'text-white'}
>
{stat.value}
</Text>
{stat.subValue && (
<Text size="xs" weight="bold" color="text-gray-600" font="mono">
{stat.subValue}
</Text>
)}
</Box>
</Box>
))}
</Box>
);
}