Files
gridpilot.gg/apps/website/components/teams/TeamRosterItem.tsx
2026-01-18 16:18:18 +01:00

73 lines
2.0 KiB
TypeScript

import React, { ReactNode } from 'react';
import { Stack } from '@/ui/Stack';
import { Text } from '@/ui/Text';
import { DriverIdentity } from '@/components/drivers/DriverIdentity';
import { DriverViewModel } from '@/lib/view-models/DriverViewModel';
interface TeamRosterItemProps {
driver: DriverViewModel;
href: string;
roleLabel: string;
joinedAt: string | Date;
rating: number | null;
overallRank: number | null;
actions?: ReactNode;
}
export function TeamRosterItem({
driver,
href,
roleLabel,
joinedAt,
rating,
overallRank,
actions,
}: TeamRosterItemProps) {
return (
<Stack
bg="bg-iron-gray/50"
rounded="lg"
border={true}
borderColor="border-charcoal-outline"
p={4}
>
<Stack direction="row" align="center" justify="between" wrap gap={4}>
<DriverIdentity
driver={driver}
href={href}
contextLabel={roleLabel}
meta={
<Text size="xs" color="text-gray-400">
{driver.country} Joined {new Date(joinedAt).toLocaleDateString()}
</Text>
}
size="md"
/>
{rating !== null && (
<Stack direction="row" align="center" gap={6}>
<Stack display="flex" flexDirection="col" alignItems="center">
<Text size="lg" weight="bold" color="text-primary-blue" block>
{rating}
</Text>
<Text size="xs" color="text-gray-400">Rating</Text>
</Stack>
{overallRank !== null && (
<Stack display="flex" flexDirection="col" alignItems="center">
<Text size="sm" color="text-gray-300" block>#{overallRank}</Text>
<Text size="xs" color="text-gray-500">Rank</Text>
</Stack>
)}
</Stack>
)}
{actions && (
<Stack direction="row" align="center" gap={2}>
{actions}
</Stack>
)}
</Stack>
</Stack>
);
}