Files
gridpilot.gg/apps/website/components/achievements/AchievementCard.tsx
2026-01-18 16:43:32 +01:00

51 lines
1.3 KiB
TypeScript

import { Card } from '@/ui/Card';
import { Text } from '@/ui/Text';
import { Stack } from '@/ui/primitives/Stack';
interface AchievementCardProps {
title: string;
description: string;
icon: string;
unlockedAt: string;
rarity: 'common' | 'rare' | 'epic' | 'legendary';
}
const rarityColors = {
common: 'border-gray-500 bg-gray-500/10',
rare: 'border-blue-400 bg-blue-400/10',
epic: 'border-purple-400 bg-purple-400/10',
legendary: 'border-warning-amber bg-warning-amber/10'
};
export function AchievementCard({
title,
description,
icon,
unlockedAt,
rarity,
}: AchievementCardProps) {
return (
<Card
p={4}
rounded="lg"
variant="outline"
className={rarityColors[rarity]}
>
<Stack direction="row" align="start" gap={3}>
<Text size="3xl">{icon}</Text>
<Stack gap={1} flexGrow={1}>
<Text weight="medium" color="text-white">{title}</Text>
<Text size="xs" color="text-gray-400">{description}</Text>
<Text size="xs" color="text-gray-500">
{new Date(unlockedAt).toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric'
})}
</Text>
</Stack>
</Stack>
</Card>
);
}