mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: compare button
This commit is contained in:
1 parent
d3760f7705
commit
798b6894a9
2 files changed
+22
-8
No files matched your search
@@ -15,10 +15,9 @@ export function CharacteristicsSection() {
|
|||||||
return (
|
return (
|
||||||
<PageWrapper>
|
<PageWrapper>
|
||||||
<Flex
|
<Flex
|
||||||
gap="5"
|
gap={wideFormat ? '4' : '6'}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
direction={wideFormat ? 'row' : 'column'}
|
direction={wideFormat ? 'row' : 'column'}
|
||||||
align={wideFormat ? undefined : 'center'}
|
|
||||||
>
|
>
|
||||||
<Flex style={{ flex: 1, maxWidth: 480 }} direction="column" gap="4">
|
<Flex style={{ flex: 1, maxWidth: 480 }} direction="column" gap="4">
|
||||||
<Heading>Configure</Heading>
|
<Heading>Configure</Heading>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Flex, Heading, Text } from '@radix-ui/themes';
|
import { CaretRightIcon } from '@radix-ui/react-icons';
|
||||||
|
import { Button, Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
|
import Link from 'next/link';
|
||||||
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
||||||
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
||||||
import strings from '../../../../../../lang/en-US.json';
|
import strings from '../../../../../../lang/en-US.json';
|
||||||
@@ -8,8 +10,13 @@ import { TankSandbox } from './TankSandbox';
|
|||||||
import { Options } from './components/Options';
|
import { Options } from './components/Options';
|
||||||
|
|
||||||
export function HeroSection() {
|
export function HeroSection() {
|
||||||
const tank = useDuel((state) => state.protagonist!.tank);
|
const protagonistTank = useDuel((state) => state.protagonist!.tank);
|
||||||
|
const antagonistTank = useDuel((state) => state.antagonist!.tank);
|
||||||
const wideFormat = useWideFormat(880);
|
const wideFormat = useWideFormat(880);
|
||||||
|
const compareTanks =
|
||||||
|
protagonistTank.id === antagonistTank.id
|
||||||
|
? [protagonistTank.id]
|
||||||
|
: [protagonistTank.id, antagonistTank.id];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@@ -42,16 +49,24 @@ export function HeroSection() {
|
|||||||
ml={wideFormat ? '8' : undefined}
|
ml={wideFormat ? '8' : undefined}
|
||||||
align={wideFormat ? undefined : 'center'}
|
align={wideFormat ? undefined : 'center'}
|
||||||
>
|
>
|
||||||
<Heading size={wideFormat ? '9' : '8'}>{tank.name}</Heading>
|
<Heading size={wideFormat ? '9' : '8'}>
|
||||||
|
{protagonistTank.name}
|
||||||
|
</Heading>
|
||||||
<Text color="gray">
|
<Text color="gray">
|
||||||
Tier {TIER_ROMAN_NUMERALS[tank.tier]}{' '}
|
Tier {TIER_ROMAN_NUMERALS[protagonistTank.tier]}{' '}
|
||||||
{
|
{
|
||||||
(strings.common.nations_adjectives as Record<string, string>)[
|
(strings.common.nations_adjectives as Record<string, string>)[
|
||||||
tank.nation
|
protagonistTank.nation
|
||||||
]
|
]
|
||||||
}{' '}
|
}{' '}
|
||||||
{strings.common.tank_class_short[tank.class]}
|
{strings.common.tank_class_short[protagonistTank.class]}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
<Link href={`/tools/compare?tanks=${compareTanks.join('%2C')}`}>
|
||||||
|
<Button variant="ghost">
|
||||||
|
Compare <CaretRightIcon />
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user