73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import { LucideIcon } from 'lucide-react';
|
|
import { ReactNode } from 'react';
|
|
import { Box } from './Box';
|
|
import { Button } from './Button';
|
|
import { Icon } from './Icon';
|
|
import { Surface } from './Surface';
|
|
import { Text } from './Text';
|
|
|
|
export interface LeaderboardPreviewShellProps {
|
|
title: string;
|
|
subtitle?: string;
|
|
icon: LucideIcon;
|
|
intent?: 'primary' | 'success' | 'warning' | 'critical' | 'telemetry';
|
|
children: ReactNode;
|
|
footer?: ReactNode;
|
|
onViewFull?: () => void;
|
|
iconColor?: string;
|
|
iconBgGradient?: string;
|
|
viewFullLabel?: string;
|
|
}
|
|
|
|
export const LeaderboardPreviewShell = ({
|
|
title,
|
|
subtitle,
|
|
icon,
|
|
intent = 'primary',
|
|
children,
|
|
footer,
|
|
onViewFull,
|
|
iconColor,
|
|
iconBgGradient,
|
|
viewFullLabel
|
|
}: LeaderboardPreviewShellProps) => {
|
|
return (
|
|
<Surface variant="precision" rounded="xl" style={{ overflow: 'hidden' }}>
|
|
<Box padding={6} borderBottom borderColor="var(--ui-color-border-muted)">
|
|
<Box display="flex" alignItems="center" justifyContent="between" marginBottom={6}>
|
|
<Box display="flex" alignItems="center" gap={5}>
|
|
<Box padding={3} rounded="xl" bg={iconBgGradient || "var(--ui-color-bg-surface-muted)"} style={iconColor ? { color: iconColor } : undefined}>
|
|
<Icon icon={icon} size={6} intent={iconColor ? undefined : intent} />
|
|
</Box>
|
|
<Box>
|
|
<Text size="xl" weight="bold" variant="high" block>
|
|
{title}
|
|
</Text>
|
|
{subtitle && (
|
|
<Text size="sm" variant="low" uppercase weight="bold" letterSpacing="widest">
|
|
{subtitle}
|
|
</Text>
|
|
)}
|
|
</Box>
|
|
</Box>
|
|
{onViewFull && (
|
|
<Button variant="ghost" size="sm" onClick={onViewFull}>
|
|
{viewFullLabel || 'View Full'}
|
|
</Button>
|
|
)}
|
|
</Box>
|
|
</Box>
|
|
|
|
<Box>
|
|
{children}
|
|
</Box>
|
|
|
|
{footer && (
|
|
<Box padding={4} borderTop borderColor="var(--ui-color-border-muted)" bg="rgba(255,255,255,0.02)">
|
|
{footer}
|
|
</Box>
|
|
)}
|
|
</Surface>
|
|
);
|
|
};
|