Files
blitzkit/packages/website/src/components/TankRowHeaderCell.tsx
T

70 lines
1.9 KiB
TypeScript
Raw Normal View History

2024-10-05 15:57:34 -05:00
import { type TankDefinition, tankIcon, TankType } from '@blitzkit/core';
2024-09-23 10:49:54 -05:00
import { Link } from '@radix-ui/themes';
2024-09-07 21:45:00 -05:00
import { classIcons } from './ClassIcon';
2024-07-18 19:08:30 -05:00
import { ExperimentIcon } from './ExperimentIcon';
2024-07-07 21:13:40 -05:00
import { StickyRowHeaderCell } from './StickyRowHeaderCell';
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-07-07 21:13:40 -05:00
<StickyRowHeaderCell
2024-07-13 13:53:59 -05:00
width={{ initial: '144px', sm: '240px' }}
2024-07-12 19:55:41 -05:00
style={{ overflow: 'hidden' }}
2024-07-02 20:07:16 -05:00
>
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))',
2024-07-07 18:19:45 -05:00
aspectRatio: '4 / 3',
2024-06-30 18:26:05 -05:00
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={
2024-10-05 15:57:34 -05:00
tank.type === TankType.COLLECTOR
2024-07-02 18:42:23 -05:00
? 'blue'
2024-10-05 15:57:34 -05:00
: tank.type === TankType.PREMIUM
2024-09-08 10:11:24 -05:00
? 'amber'
: 'gray'
2024-07-02 18:42:23 -05:00
}
2024-10-05 15:57:34 -05:00
highContrast={tank.type === TankType.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-07-02 20:12:15 -05:00
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
2024-06-30 18:26:05 -05:00
}}
2024-07-12 13:01:10 -05:00
size={{ initial: '1', sm: '2' }}
2024-06-30 18:26:05 -05:00
>
2024-07-02 20:12:15 -05:00
<Icon
width="1em"
height="1em"
2024-07-12 13:01:10 -05:00
style={{ minWidth: '1em', minHeight: '1em' }}
2024-07-02 20:12:15 -05:00
/>
2024-07-02 18:42:23 -05:00
{tank.testing && (
2024-07-18 19:08:30 -05:00
<ExperimentIcon style={{ width: '1em', height: '1em' }} />
2024-07-02 18:42:23 -05:00
)}
2024-07-18 19:08:30 -05:00
{tank.name}
2024-06-29 21:22:12 -05:00
</Link>
2024-07-07 21:13:40 -05:00
</StickyRowHeaderCell>
2024-06-29 21:22:12 -05:00
);
}