2024-08-05 14:25:12 -05:00
|
|
|
import { Flex, Text } from '@radix-ui/themes';
|
|
|
|
|
import { times } from 'lodash';
|
2024-08-05 12:52:40 -05:00
|
|
|
import { ReactNode } from 'react';
|
|
|
|
|
import { TanksEmbedState } from '../app/tools/embed/customize/tanks/page';
|
2024-08-05 14:25:12 -05:00
|
|
|
import {
|
|
|
|
|
toColorVar,
|
|
|
|
|
toRadiusVar,
|
|
|
|
|
toWidthVar,
|
|
|
|
|
} from '../app/tools/embed/utilities';
|
2024-08-05 12:52:40 -05:00
|
|
|
import { TankDefinition } from '../core/blitzkit/tankDefinitions';
|
|
|
|
|
|
|
|
|
|
interface TanksEmbedWrapperProps {
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
state: TanksEmbedState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function TanksEmbedWrapper({ children, state }: TanksEmbedWrapperProps) {
|
|
|
|
|
return (
|
2024-08-05 14:25:12 -05:00
|
|
|
<Flex
|
|
|
|
|
direction="column"
|
|
|
|
|
gap={state.listGap}
|
|
|
|
|
width={toWidthVar(state.listWidth)}
|
|
|
|
|
>
|
2024-08-05 12:52:40 -05:00
|
|
|
{children}
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface TanksEmbedCardProps {
|
|
|
|
|
tank: TankDefinition;
|
|
|
|
|
state: TanksEmbedState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function TanksEmbedCard({ tank, state }: TanksEmbedCardProps) {
|
|
|
|
|
return (
|
|
|
|
|
<Flex
|
|
|
|
|
direction="column"
|
|
|
|
|
style={{
|
2024-08-05 14:25:12 -05:00
|
|
|
borderRadius: toRadiusVar(state.cardRadius),
|
2024-08-05 12:52:40 -05:00
|
|
|
overflow: 'hidden',
|
2024-08-05 14:25:12 -05:00
|
|
|
backgroundColor: toColorVar(state.cardBodyBackgroundColor),
|
2024-08-05 12:52:40 -05:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Flex
|
|
|
|
|
justify="center"
|
|
|
|
|
style={{
|
2024-08-05 14:25:12 -05:00
|
|
|
backgroundColor: toColorVar(state.cardHeaderBackgroundColor),
|
2024-08-05 12:52:40 -05:00
|
|
|
}}
|
|
|
|
|
p={state.cardHeaderPadding}
|
|
|
|
|
>
|
|
|
|
|
{tank.name}
|
|
|
|
|
</Flex>
|
2024-08-05 14:25:12 -05:00
|
|
|
|
|
|
|
|
<Flex p={state.cardBodyPadding}>
|
|
|
|
|
{times(4, (index) => {
|
|
|
|
|
const column = (index + 1) as 1 | 2 | 3 | 4;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Flex
|
|
|
|
|
direction="column"
|
|
|
|
|
align="center"
|
|
|
|
|
gap={state.columnGap}
|
|
|
|
|
flexGrow="1"
|
|
|
|
|
>
|
|
|
|
|
<Text size={state.columnValueSize} color={state.columnValueColor}>
|
|
|
|
|
70{state[`column${column}Unit`]}
|
|
|
|
|
</Text>
|
|
|
|
|
<Text size={state.columnLabelSize} color={state.columnLabelColor}>
|
|
|
|
|
{state[`column${column}Label`]}
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
2024-08-05 12:52:40 -05:00
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|