39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { Surface } from './primitives/Surface';
|
|
import { Box } from './primitives/Box';
|
|
import { Text } from './Text';
|
|
import { Icon } from './Icon';
|
|
import { LucideIcon } from 'lucide-react';
|
|
|
|
export interface StatBoxProps {
|
|
label: string;
|
|
value: string | number;
|
|
icon: LucideIcon;
|
|
intent?: 'primary' | 'success' | 'warning' | 'critical' | 'telemetry';
|
|
}
|
|
|
|
export const StatBox = ({
|
|
label,
|
|
value,
|
|
icon,
|
|
intent = 'primary'
|
|
}: StatBoxProps) => {
|
|
return (
|
|
<Surface variant="muted" rounded="xl" padding={4} style={{ border: '1px solid var(--ui-color-border-default)' }}>
|
|
<Box display="flex" alignItems="center" gap={4}>
|
|
<Box padding={2} rounded="lg" bg="var(--ui-color-bg-surface-muted)">
|
|
<Icon icon={icon} size={5} intent={intent} />
|
|
</Box>
|
|
<Box>
|
|
<Text size="xs" weight="bold" variant="low" uppercase>
|
|
{label}
|
|
</Text>
|
|
<Text size="xl" weight="bold" variant="high" block marginTop={0.5}>
|
|
{value}
|
|
</Text>
|
|
</Box>
|
|
</Box>
|
|
</Surface>
|
|
);
|
|
};
|