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

63 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-10-14 12:11:31 -05:00
import { type TankDefinition, tankIcon, TankType } from "@blitzkit/core";
2025-10-14 21:53:58 -05:00
import { Box, Flex } from "@radix-ui/themes";
2025-10-14 12:11:31 -05:00
import { useLocale } from "../hooks/useLocale";
import { classIcons } from "./ClassIcon";
import { ExperimentIcon } from "./ExperimentIcon";
import { LinkI18n } from "./LinkI18n";
import { StickyRowHeaderCell } from "./StickyRowHeaderCell";
2024-06-29 21:22:12 -05:00
interface TankRowHeaderCellProps {
tank: TankDefinition;
}
export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
2025-01-14 19:22:41 -06:00
const { locale, unwrap } = useLocale();
2024-07-02 18:42:23 -05:00
const Icon = classIcons[tank.class];
2024-06-29 21:22:12 -05:00
return (
2025-10-14 12:11:31 -05:00
<StickyRowHeaderCell style={{ overflow: "hidden" }}>
2024-12-27 14:01:59 -06:00
<LinkI18n
locale={locale}
2024-07-02 18:42:23 -05:00
color={
2024-10-05 15:57:34 -05:00
tank.type === TankType.COLLECTOR
2025-10-14 12:11:31 -05:00
? "blue"
2024-10-05 15:57:34 -05:00
: tank.type === TankType.PREMIUM
2025-10-14 12:11:31 -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"
2025-05-15 23:44:20 -05:00
href={`/tanks/${tank.slug}`}
2025-10-14 21:53:58 -05:00
style={{ height: "100%" }}
2025-10-14 12:11:31 -05:00
size={{ initial: "1", sm: "2" }}
2024-06-30 18:26:05 -05:00
>
2025-10-14 21:53:58 -05:00
<Flex height="100%" align="center" gap="1">
<Box
draggable={false}
height="calc(100% + 2 * var(--table-cell-padding))"
style={{
aspectRatio: "4 / 3",
backgroundImage: `url(${tankIcon(tank.id)})`,
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
}}
/>
2024-07-02 18:42:23 -05:00
2025-10-14 21:53:58 -05:00
<Icon
width="1em"
height="1em"
style={{ minWidth: "1em", minHeight: "1em" }}
/>
2024-07-18 19:08:30 -05:00
2025-10-14 21:53:58 -05:00
{tank.testing && (
<ExperimentIcon style={{ width: "1em", height: "1em" }} />
)}
{unwrap(tank.name)}
</Flex>
2024-12-27 14:01:59 -06:00
</LinkI18n>
2024-07-07 21:13:40 -05:00
</StickyRowHeaderCell>
2024-06-29 21:22:12 -05:00
);
}