feat: responsive tech tree

This commit is contained in:
TrèsAbhi committed 2024-05-04 16:37:36 -05:00
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 { tankDefinitions } from '../../../../../../core/blitzkit/tankDefinitions';
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
import { useDuel } from '../../../../../../stores/duel';
export function TreeArrow({
@@ -50,6 +51,7 @@ export function TreeArrow({
}
export function TechTreeSection() {
const wideFormat = useWideFormat(720);
const awaitedTankDefinitions = use(tankDefinitions);
const tank = useDuel((state) => state.protagonist!.tank);
@@ -65,6 +67,7 @@ export function TechTreeSection() {
style={{
textDecoration: 'none',
color: 'inherit',
position: 'relative',
}}
>
<Flex direction="column" align="center">
@@ -125,9 +128,6 @@ export function TechTreeSection() {
return (
<PageWrapper
style={{
position: 'relative',
}}
containerProps={{
style: {
overflow: 'hidden',
@@ -138,20 +138,6 @@ export function TechTreeSection() {
gap="0"
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">
<Heading>Tech tree</Heading>
</Flex> */}
@@ -159,15 +145,14 @@ export function TechTreeSection() {
<Flex
align="center"
gap="6"
style={{
zIndex: 1,
}}
style={{}}
direction={wideFormat ? 'row' : 'column'}
>
{tank.ancestors && (
<>
<Flex
wrap="wrap"
direction="column"
direction={wideFormat ? 'column' : 'row'}
align="center"
justify="center"
style={{
@@ -180,21 +165,41 @@ export function TechTreeSection() {
))}
</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} />
</Flex>
{tank.successors && (
<>
<TreeArrow />
<TreeArrow down={!wideFormat} />
<Flex
wrap="wrap"
direction="column"
direction={wideFormat ? 'column' : 'row'}
align="center"
justify="center"
style={{
+1 -1
View File
@@ -87,7 +87,7 @@ export default function Navbar() {
left: 0,
width: '100%',
height: 64 + 1, // extra pixel for frost bleeding
zIndex: 1,
zIndex: 2,
padding: '1rem',
background: theme.colors.appBackground1_alpha,
borderBottom: theme.borderStyles.nonInteractive,
+1 -1
View File
@@ -24,6 +24,7 @@ export default function PageWrapper({
}: PageWrapperProps) {
return (
<Theme
{...containerProps}
accentColor={color}
style={{
flex: 1,
@@ -34,7 +35,6 @@ export default function PageWrapper({
: undefined,
...containerProps?.style,
}}
{...containerProps}
>
<Flex
direction="column"