diff --git a/src/components/MobileControlsDock.tsx b/src/components/MobileControlsDock.tsx new file mode 100644 index 0000000..3ec2eee --- /dev/null +++ b/src/components/MobileControlsDock.tsx @@ -0,0 +1,40 @@ +import React from "react"; + +type MobileControlsDockProps = { + children: React.ReactNode; + /** When false, renders nothing. */ + visible?: boolean; + /** Optional override for the outer z-index. */ + zIndexClassName?: string; +}; + +/** + * Fixed bottom dock for mobile game controls. + * - Always visible on screen + * - Respects iOS safe-area + * - Keeps design tokens (no raw colors) + */ +export function MobileControlsDock({ + children, + visible = true, + zIndexClassName = "z-[70]", +}: MobileControlsDockProps) { + if (!visible) return null; + + return ( +
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LVL
{level}
♥
{lives}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LVL
{level}
♥
{lives}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LVL
{level}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LVL
{level}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LEN
{snake.length}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LEN
{snake.length}
PLAYER 1 (WASD)
+ {!isMobile && ( +PLAYER 1 (WASD)
+{players[0].score}
+ {!players[0].alive &&DEAD
}{players[0].score}
- {!players[0].alive &&DEAD
} -PLAYER 2 (↑↓←→)
+ + {/* Player 2 Stats */} +PLAYER 2 (↑↓←→)
+{players[1].score}
+ {!players[1].alive &&DEAD
}{players[1].score}
- {!players[1].alive &&DEAD
} + +CONTROLS
+P1: W A S D
+P2: ↑ ↓ ← →
+P: Pause
+CONTROLS
-P1: W A S D
-P2: ↑ ↓ ← →
-P: Pause
-P1
{players[0].score}
P2
{players[1].score}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LINES
{lines}
SCORE
{score.toLocaleString()}
HIGH
{highScore.toLocaleString()}
LINES
{lines}