Files
blitzkit/src/components/TankRowHeaderCell.tsx
T

79 lines
2.0 KiB
TypeScript
Raw Normal View History

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-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-07 18:19:45 -05:00
maxWidth={{
initial: '180px',
sm: '240px',
}}
2024-07-02 20:07:16 -05:00
style={{
2024-07-02 20:12:15 -05:00
overflow: 'hidden',
2024-07-07 21:13:40 -05:00
display: 'flex',
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={
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-07-02 20:12:15 -05:00
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
2024-06-30 18:26:05 -05:00
}}
>
2024-07-02 20:12:15 -05:00
<Icon
width="1em"
height="1em"
style={{
minWidth: '1em',
minHeight: '1em',
}}
/>
2024-07-02 18:42:23 -05:00
2024-06-30 19:34:55 -05:00
{tank.name}
2024-07-02 18:42:23 -05:00
{tank.testing && (
2024-07-02 20:12:15 -05:00
<ScienceIcon style={{ width: '1em', height: '1em' }} />
2024-07-02 18:42:23 -05:00
)}
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
);
}