From c845b0cb51551a15db30342823468870ac4a732e Mon Sep 17 00:00:00 2001 From: Frank Schwenk Date: Fri, 6 Jun 2025 12:54:13 +0200 Subject: [PATCH] refactor(new-game): modernize UI, remove player selects - Refactored New Game screen to use a modern, card-like, dark-themed layout - Removed select dropdowns for previous players, now only datalist+input for player names - Updated paddings, backgrounds, borders, and font sizes for a visually consistent, modern look - No logic changes, only markup and style Refs #1 --- package.json | 2 +- src/components/NewGame.jsx | 79 ++++++++++++---------- src/components/NewGame.module.css | 107 ++++++++++++++++++------------ 3 files changed, 111 insertions(+), 77 deletions(-) diff --git a/package.json b/package.json index b95e6bc..3a8d8e7 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "type": "module", "version": "0.0.1", "scripts": { - "dev": "astro dev", + "dev": "astro dev --host", "build": "astro build", "preview": "astro preview", "astro": "astro" diff --git a/src/components/NewGame.jsx b/src/components/NewGame.jsx index 8e4b997..e3bf7f4 100644 --- a/src/components/NewGame.jsx +++ b/src/components/NewGame.jsx @@ -28,43 +28,54 @@ export default function NewGame({ onCreateGame, playerNameHistory, onCancel }) { return (
-
- - setPlayer1(e.target.value)} list="player1-history" /> - - {playerNameHistory.map(name => +
Neues Spiel
+
+
+ +
+ setPlayer1(e.target.value)} list="player1-history" /> + + {playerNameHistory.map(name => +
+
+
+ +
+ setPlayer2(e.target.value)} list="player2-history" /> + + {playerNameHistory.map(name => +
+
+
+ +
+ setPlayer3(e.target.value)} list="player3-history" /> + + {playerNameHistory.map(name => +
+
-
- - setPlayer2(e.target.value)} list="player2-history" /> - - {playerNameHistory.map(name => -
-
- - setPlayer3(e.target.value)} list="player3-history" /> - - {playerNameHistory.map(name => -
-
- - -
-
- - setRaceTo(e.target.value)} min="1" /> +
+
+ + +
+
+ + setRaceTo(e.target.value)} min="1" /> +
{error &&
{error}
} -
- - +
+ +
); diff --git a/src/components/NewGame.module.css b/src/components/NewGame.module.css index 87aa687..f1f3b14 100644 --- a/src/components/NewGame.module.css +++ b/src/components/NewGame.module.css @@ -18,94 +18,117 @@ -webkit-overflow-scrolling: touch; } .screen-title { - font-size: 24px; - margin-bottom: 20px; + font-size: 2rem; + font-weight: 700; + color: #fff; + margin-bottom: 32px; + letter-spacing: 0.5px; } .player-inputs { display: flex; flex-direction: column; - gap: 20px; + gap: 24px; width: 100%; - flex: 1; + margin-bottom: 32px; } .player-input { - margin-bottom: 20px; + background: #222; + border-radius: 8px; + padding: 20px 16px 16px 16px; + margin-bottom: 0; + box-shadow: 0 1px 4px rgba(0,0,0,0.12); } .player-input label { display: block; - margin-bottom: 10px; + margin-bottom: 12px; color: #ccc; - font-size: 24px; + font-size: 1.2rem; + font-weight: 600; } .name-input-container { display: flex; - gap: 10px; -} -.name-select { - flex: 1; - padding: 30px; - border: 2px solid #333; - background: #2a2a2a; - color: white; - font-size: 24px; - min-height: 44px; + gap: 12px; } .name-input { flex: 2; - padding: 30px; + padding: 14px 12px; border: 2px solid #333; background: #2a2a2a; color: white; - font-size: 24px; + font-size: 1.1rem; min-height: 44px; -} -.name-select:focus, .name-input:focus { - outline: none; - border-color: #666; + border-radius: 0 6px 6px 0; } .game-settings { - margin-top: 20px; + margin-top: 0; width: 100%; + margin-bottom: 32px; } .setting-group { margin-bottom: 20px; } -.setting-group select { +.setting-group label { + display: block; + margin-bottom: 10px; + color: #ccc; + font-size: 1.1rem; + font-weight: 600; +} +.setting-group select, .setting-group input { width: 100%; - padding: 30px; + padding: 14px 12px; border: 2px solid #333; background: #2a2a2a; color: white; - font-size: 24px; + font-size: 1.1rem; min-height: 44px; - padding: 12px; + border-radius: 6px; } -.setting-group input { - width: 100%; - padding: 30px; - border: 2px solid #333; - background: #2a2a2a; - color: white; - font-size: 24px; -} -.setting-group input:focus { +.setting-group input:focus, .setting-group select:focus { outline: none; border-color: #666; } +.validation-error { + color: #f44336; + background: #2a2a2a; + border-radius: 6px; + padding: 12px; + margin-bottom: 16px; + font-size: 1.1rem; + text-align: center; +} .nav-buttons { display: flex; flex-direction: column; - gap: 10px; - margin: 20px 0 40px 0; + gap: 12px; + margin: 16px 0 0 0; } .btn { flex: 1; min-width: 100px; - padding: 20px; + padding: 18px; color: white; + background: #333; border: none; - border-radius: 0; - font-size: 20px; + border-radius: 6px; + font-size: 1.2rem; + font-weight: 600; cursor: pointer; touch-action: manipulation; + transition: background 0.2s, color 0.2s; +} +.btn:hover { + background: #444; +} +.new-game-form { + width: 100%; + max-width: 700px; + margin: 32px auto 0 auto; + background: #181818; + border-radius: 12px; + box-shadow: 0 2px 16px rgba(0,0,0,0.4); + padding: 32px 24px 24px 24px; + display: flex; + flex-direction: column; + gap: 0; } \ No newline at end of file