Files
gridpilot.gg/apps/website/components/leaderboards/LeaderboardHeader.tsx
2026-01-18 23:24:30 +01:00

72 lines
1.8 KiB
TypeScript

import { Button } from '@/ui/Button';
import { Heading } from '@/ui/Heading';
import { Icon } from '@/ui/Icon';
import { Stack } from '@/ui/Stack';
import { Text } from '@/ui/Text';
import { ArrowLeft, LucideIcon } from 'lucide-react';
import React from 'react';
interface LeaderboardHeaderProps {
title: string;
description?: string;
icon?: LucideIcon;
onBack?: () => void;
backLabel?: string;
children?: React.ReactNode;
}
export function LeaderboardHeader({
title,
description,
icon,
onBack,
backLabel = 'Back',
children,
}: LeaderboardHeaderProps) {
return (
<Stack mb={8}>
{onBack && (
<Stack mb={6}>
<Button
variant="secondary"
onClick={onBack}
icon={<Icon icon={ArrowLeft} size={4} />}
>
{backLabel}
</Button>
</Stack>
)}
<Stack direction="row" align="center" justify="between" gap={4}>
<Stack direction="row" align="center" gap={4}>
{icon && (
<Stack
p={3}
bg="linear-gradient(to bottom right, rgba(25, 140, 255, 0.15), rgba(25, 140, 255, 0.05))"
border
borderColor="border-primary-blue/20"
rounded="xl"
display="flex"
alignItems="center"
justifyContent="center"
>
<Icon icon={icon} size={6} color="text-primary-blue" />
</Stack>
)}
<Stack>
<Heading level={1} weight="bold" letterSpacing="tight">{title}</Heading>
{description && (
<Text color="text-gray-400" block mt={1} size="sm">
{description}
</Text>
)}
</Stack>
</Stack>
<Stack>
{children}
</Stack>
</Stack>
</Stack>
);
}