mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: responsive tech tree
This commit is contained in:
1 parent
97cd218796
commit
a7f2c3e324
3 files changed
+32
-27
No files matched your search
@@ -6,6 +6,7 @@ import PageWrapper from '../../../../../../components/PageWrapper';
|
|||||||
import { asset } from '../../../../../../core/blitzkit/asset';
|
import { asset } from '../../../../../../core/blitzkit/asset';
|
||||||
import { tankDefinitions } from '../../../../../../core/blitzkit/tankDefinitions';
|
import { tankDefinitions } from '../../../../../../core/blitzkit/tankDefinitions';
|
||||||
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
||||||
|
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
||||||
import { useDuel } from '../../../../../../stores/duel';
|
import { useDuel } from '../../../../../../stores/duel';
|
||||||
|
|
||||||
export function TreeArrow({
|
export function TreeArrow({
|
||||||
@@ -50,6 +51,7 @@ export function TreeArrow({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function TechTreeSection() {
|
export function TechTreeSection() {
|
||||||
|
const wideFormat = useWideFormat(720);
|
||||||
const awaitedTankDefinitions = use(tankDefinitions);
|
const awaitedTankDefinitions = use(tankDefinitions);
|
||||||
const tank = useDuel((state) => state.protagonist!.tank);
|
const tank = useDuel((state) => state.protagonist!.tank);
|
||||||
|
|
||||||
@@ -65,6 +67,7 @@ export function TechTreeSection() {
|
|||||||
style={{
|
style={{
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
color: 'inherit',
|
color: 'inherit',
|
||||||
|
position: 'relative',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex direction="column" align="center">
|
<Flex direction="column" align="center">
|
||||||
@@ -125,9 +128,6 @@ export function TechTreeSection() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapper
|
<PageWrapper
|
||||||
style={{
|
|
||||||
position: 'relative',
|
|
||||||
}}
|
|
||||||
containerProps={{
|
containerProps={{
|
||||||
style: {
|
style: {
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
@@ -138,20 +138,6 @@ export function TechTreeSection() {
|
|||||||
gap="0"
|
gap="0"
|
||||||
highlight
|
highlight
|
||||||
>
|
>
|
||||||
<img
|
|
||||||
alt={tank.nation}
|
|
||||||
src={asset(`flags/scratched/${tank.nation}.webp`)}
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
top: '50%',
|
|
||||||
left: '50%',
|
|
||||||
height: '200%',
|
|
||||||
transform: 'translate(-40%, -48%)',
|
|
||||||
backgroundRepeat: 'no-repeat',
|
|
||||||
opacity: 1 / 4,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* <Flex justify="center">
|
{/* <Flex justify="center">
|
||||||
<Heading>Tech tree</Heading>
|
<Heading>Tech tree</Heading>
|
||||||
</Flex> */}
|
</Flex> */}
|
||||||
@@ -159,15 +145,14 @@ export function TechTreeSection() {
|
|||||||
<Flex
|
<Flex
|
||||||
align="center"
|
align="center"
|
||||||
gap="6"
|
gap="6"
|
||||||
style={{
|
style={{}}
|
||||||
zIndex: 1,
|
direction={wideFormat ? 'row' : 'column'}
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{tank.ancestors && (
|
{tank.ancestors && (
|
||||||
<>
|
<>
|
||||||
<Flex
|
<Flex
|
||||||
wrap="wrap"
|
wrap="wrap"
|
||||||
direction="column"
|
direction={wideFormat ? 'column' : 'row'}
|
||||||
align="center"
|
align="center"
|
||||||
justify="center"
|
justify="center"
|
||||||
style={{
|
style={{
|
||||||
@@ -180,21 +165,41 @@ export function TechTreeSection() {
|
|||||||
))}
|
))}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<TreeArrow />
|
<TreeArrow down={!wideFormat} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Flex direction="column">
|
<Flex
|
||||||
|
direction="column"
|
||||||
|
style={{
|
||||||
|
position: 'relative',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt={tank.nation}
|
||||||
|
src={asset(`flags/scratched/${tank.nation}.webp`)}
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: '50%',
|
||||||
|
left: '50%',
|
||||||
|
height: '200%',
|
||||||
|
transform: 'translate(-40%, -50%)',
|
||||||
|
backgroundRepeat: 'no-repeat',
|
||||||
|
opacity: 1 / 4,
|
||||||
|
filter: 'blur(4px)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Card id={tank.id} />
|
<Card id={tank.id} />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
{tank.successors && (
|
{tank.successors && (
|
||||||
<>
|
<>
|
||||||
<TreeArrow />
|
<TreeArrow down={!wideFormat} />
|
||||||
|
|
||||||
<Flex
|
<Flex
|
||||||
wrap="wrap"
|
wrap="wrap"
|
||||||
direction="column"
|
direction={wideFormat ? 'column' : 'row'}
|
||||||
align="center"
|
align="center"
|
||||||
justify="center"
|
justify="center"
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default function Navbar() {
|
|||||||
left: 0,
|
left: 0,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 64 + 1, // extra pixel for frost bleeding
|
height: 64 + 1, // extra pixel for frost bleeding
|
||||||
zIndex: 1,
|
zIndex: 2,
|
||||||
padding: '1rem',
|
padding: '1rem',
|
||||||
background: theme.colors.appBackground1_alpha,
|
background: theme.colors.appBackground1_alpha,
|
||||||
borderBottom: theme.borderStyles.nonInteractive,
|
borderBottom: theme.borderStyles.nonInteractive,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export default function PageWrapper({
|
|||||||
}: PageWrapperProps) {
|
}: PageWrapperProps) {
|
||||||
return (
|
return (
|
||||||
<Theme
|
<Theme
|
||||||
|
{...containerProps}
|
||||||
accentColor={color}
|
accentColor={color}
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@@ -34,7 +35,6 @@ export default function PageWrapper({
|
|||||||
: undefined,
|
: undefined,
|
||||||
...containerProps?.style,
|
...containerProps?.style,
|
||||||
}}
|
}}
|
||||||
{...containerProps}
|
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
direction="column"
|
direction="column"
|
||||||
|
|||||||
Reference in new issue
Block a user