Files
blitzkit/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx
T

87 lines
2.4 KiB
TypeScript
Raw Normal View History

2024-05-03 17:52:45 -05:00
import { Flex, Heading, Text } from '@radix-ui/themes';
2024-05-03 12:57:04 -05:00
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
2024-05-03 17:07:27 -05:00
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
2024-05-03 12:57:04 -05:00
import strings from '../../../../../../lang/en-US.json';
import { theme } from '../../../../../../stitches.config';
import { useDuel } from '../../../../../../stores/duel';
import { TankSandbox } from './TankSandbox';
2024-05-03 17:07:27 -05:00
import { Options } from './components/Options';
2024-05-03 12:57:04 -05:00
export function HeroSection() {
const tank = useDuel((state) => state.protagonist!.tank);
2024-05-03 17:07:27 -05:00
const wideFormat = useWideFormat(880);
2024-05-03 12:57:04 -05:00
return (
<Flex
justify="center"
2024-05-03 20:49:05 -05:00
py={wideFormat ? '0' : '6'}
2024-05-03 12:57:04 -05:00
style={{
2024-05-03 20:49:05 -05:00
background: `linear-gradient(${wideFormat ? -90 : 180}deg, ${theme.colors.appBackground1}, ${theme.colors.appBackground2})`,
2024-05-03 12:57:04 -05:00
position: 'relative',
2024-05-03 20:52:59 -05:00
height: wideFormat ? undefined : 'calc(87.5vh - 64px)',
2024-05-03 12:57:04 -05:00
}}
2024-05-03 20:49:05 -05:00
gap="4"
2024-05-03 12:57:04 -05:00
>
<Flex
2024-05-03 17:07:27 -05:00
direction={wideFormat ? 'row' : 'column'}
2024-05-03 12:57:04 -05:00
style={{
maxWidth: 1600,
flex: 1,
}}
>
<Flex
2024-05-03 17:26:14 -05:00
align="center"
2024-05-03 12:57:04 -05:00
justify="center"
style={{
2024-05-03 20:49:05 -05:00
flex: wideFormat ? 1 : undefined,
2024-05-03 12:57:04 -05:00
}}
>
2024-05-03 19:03:25 -05:00
<Flex
gap={wideFormat ? '4' : '2'}
direction="column"
2024-05-03 20:49:05 -05:00
ml={wideFormat ? '8' : undefined}
2024-05-03 19:03:25 -05:00
align={wideFormat ? undefined : 'center'}
>
2024-05-03 20:49:05 -05:00
<Heading size={wideFormat ? '9' : '8'}>{tank.name}</Heading>
2024-05-03 17:26:14 -05:00
<Text color="gray">
Tier {TIER_ROMAN_NUMERALS[tank.tier]}{' '}
2024-05-03 17:42:28 -05:00
{
(strings.common.nations_adjectives as Record<string, string>)[
tank.nation
]
}{' '}
2024-05-03 17:26:14 -05:00
{strings.common.tank_class_short[tank.class]}
</Text>
</Flex>
2024-05-03 12:57:04 -05:00
</Flex>
<div
style={{
2024-05-03 20:49:05 -05:00
height: wideFormat ? 512 : undefined,
flex: 2,
2024-05-03 12:57:04 -05:00
position: 'relative',
}}
>
<div
style={{
width: '100%',
height: '100%',
position: 'absolute',
}}
>
2024-05-03 17:35:59 -05:00
<div
style={{
width: '100%',
height: '100%',
}}
>
<TankSandbox />
</div>
2024-05-03 17:52:45 -05:00
<Options />
2024-05-03 17:35:59 -05:00
</div>
2024-05-03 12:57:04 -05:00
</div>
</Flex>
</Flex>
);
}