Files
blitzkit/src/components/TankRowHeaderCell.tsx
T

62 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-07-02 18:42:23 -05:00
import { IconButton, Table } from '@radix-ui/themes';
2024-06-29 21:22:12 -05:00
import { TankDefinition } from '../core/blitzkit/tankDefinitions';
import { tankIcon } from '../core/blitzkit/tankIcon';
2024-07-02 18:42:23 -05:00
import { classIcons } from './ClassIcon';
2024-06-29 21:22:12 -05:00
import { Link } from './Link';
2024-07-02 18:42:23 -05:00
import { ScienceIcon } from './ScienceIcon';
2024-06-29 21:22:12 -05:00
interface TankRowHeaderCellProps {
tank: TankDefinition;
}
export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
2024-07-02 18:42:23 -05:00
const Icon = classIcons[tank.class];
2024-06-29 21:22:12 -05:00
return (
2024-06-30 18:26:05 -05:00
<Table.RowHeaderCell style={{ display: 'flex' }}>
2024-06-30 19:59:32 -05:00
<Link href={`/tools/tankopedia/${tank.id}`} tabIndex={-1}>
2024-06-29 21:22:12 -05:00
<img
alt={tank.name}
draggable={false}
src={tankIcon(tank.id)}
style={{
2024-06-30 18:26:05 -05:00
margin: 'calc(-1 * var(--table-cell-padding)) 0',
height: 'calc(100% + 2 * var(--table-cell-padding))',
aspectRatio: '16 / 9',
objectFit: 'cover',
2024-06-29 21:22:12 -05:00
}}
/>
2024-06-30 18:26:05 -05:00
</Link>
2024-06-29 21:22:12 -05:00
2024-06-30 18:26:05 -05:00
<Link
2024-07-02 18:42:23 -05:00
color={
tank.treeType === 'collector'
? 'blue'
: tank.treeType === 'premium'
? 'amber'
: 'gray'
}
highContrast={tank.treeType === 'researchable'}
2024-06-30 18:26:05 -05:00
underline="hover"
wrap="nowrap"
href={`/tools/tankopedia/${tank.id}`}
style={{
paddingLeft: 'var(--space-2)',
2024-06-30 19:34:55 -05:00
display: 'flex',
alignItems: 'center',
gap: 'var(--space-1)',
2024-06-30 18:26:05 -05:00
}}
>
2024-07-02 18:42:23 -05:00
<Icon width="1em" height="1em" />
2024-06-30 19:34:55 -05:00
{tank.name}
2024-07-02 18:42:23 -05:00
{tank.testing && (
<IconButton size="1" ml="1">
<ScienceIcon style={{ width: '1em', height: '1em' }} />
</IconButton>
)}
2024-06-29 21:22:12 -05:00
</Link>
</Table.RowHeaderCell>
);
}