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
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev": "astro dev --host",
|
||||||
"build": "astro build",
|
"build": "astro build",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
|
|||||||
@@ -28,43 +28,54 @@ export default function NewGame({ onCreateGame, playerNameHistory, onCancel }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<form className={styles['new-game-form']} onSubmit={handleSubmit}>
|
<form className={styles['new-game-form']} onSubmit={handleSubmit}>
|
||||||
<div>
|
<div className={styles['screen-title']}>Neues Spiel</div>
|
||||||
<label>Spieler 1:</label>
|
<div className={styles['player-inputs']}>
|
||||||
<input value={player1} onInput={e => setPlayer1(e.target.value)} list="player1-history" />
|
<div className={styles['player-input']}>
|
||||||
<datalist id="player1-history">
|
<label>Spieler 1</label>
|
||||||
{playerNameHistory.map(name => <option value={name} key={name} />)}
|
<div className={styles['name-input-container']}>
|
||||||
</datalist>
|
<input className={styles['name-input']} placeholder="Name Spieler 1" value={player1} onInput={e => setPlayer1(e.target.value)} list="player1-history" />
|
||||||
|
<datalist id="player1-history">
|
||||||
|
{playerNameHistory.map(name => <option value={name} key={name} />)}
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={styles['player-input']}>
|
||||||
|
<label>Spieler 2</label>
|
||||||
|
<div className={styles['name-input-container']}>
|
||||||
|
<input className={styles['name-input']} placeholder="Name Spieler 2" value={player2} onInput={e => setPlayer2(e.target.value)} list="player2-history" />
|
||||||
|
<datalist id="player2-history">
|
||||||
|
{playerNameHistory.map(name => <option value={name} key={name} />)}
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={styles['player-input']}>
|
||||||
|
<label>Spieler 3 (optional)</label>
|
||||||
|
<div className={styles['name-input-container']}>
|
||||||
|
<input className={styles['name-input']} placeholder="Name Spieler 3" value={player3} onInput={e => setPlayer3(e.target.value)} list="player3-history" />
|
||||||
|
<datalist id="player3-history">
|
||||||
|
{playerNameHistory.map(name => <option value={name} key={name} />)}
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div className={styles['game-settings']}>
|
||||||
<label>Spieler 2:</label>
|
<div className={styles['setting-group']}>
|
||||||
<input value={player2} onInput={e => setPlayer2(e.target.value)} list="player2-history" />
|
<label>Spieltyp</label>
|
||||||
<datalist id="player2-history">
|
<select value={gameType} onChange={e => setGameType(e.target.value)}>
|
||||||
{playerNameHistory.map(name => <option value={name} key={name} />)}
|
<option value="8-Ball">8-Ball</option>
|
||||||
</datalist>
|
<option value="9-Ball">9-Ball</option>
|
||||||
</div>
|
<option value="10-Ball">10-Ball</option>
|
||||||
<div>
|
</select>
|
||||||
<label>Spieler 3 (optional):</label>
|
</div>
|
||||||
<input value={player3} onInput={e => setPlayer3(e.target.value)} list="player3-history" />
|
<div className={styles['setting-group']}>
|
||||||
<datalist id="player3-history">
|
<label>Race to X (optional)</label>
|
||||||
{playerNameHistory.map(name => <option value={name} key={name} />)}
|
<input type="number" value={raceTo} onInput={e => setRaceTo(e.target.value)} min="1" />
|
||||||
</datalist>
|
</div>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>Spieltyp:</label>
|
|
||||||
<select value={gameType} onChange={e => setGameType(e.target.value)}>
|
|
||||||
<option value="8-Ball">8-Ball</option>
|
|
||||||
<option value="9-Ball">9-Ball</option>
|
|
||||||
<option value="10-Ball">10-Ball</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>Race to:</label>
|
|
||||||
<input type="number" value={raceTo} onInput={e => setRaceTo(e.target.value)} min="1" />
|
|
||||||
</div>
|
</div>
|
||||||
{error && <div className={styles['validation-error']}>{error}</div>}
|
{error && <div className={styles['validation-error']}>{error}</div>}
|
||||||
<div className={styles['form-actions']}>
|
<div className={styles['nav-buttons']}>
|
||||||
<button type="button" className={styles['nav-button']} onClick={onCancel}>Abbrechen</button>
|
<button type="button" className={styles['btn']} onClick={onCancel}>Abbrechen</button>
|
||||||
<button type="submit" className={styles['nav-button']}>Spiel starten</button>
|
<button type="submit" className={styles['btn']}>Spiel starten</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,94 +18,117 @@
|
|||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
.screen-title {
|
.screen-title {
|
||||||
font-size: 24px;
|
font-size: 2rem;
|
||||||
margin-bottom: 20px;
|
font-weight: 700;
|
||||||
|
color: #fff;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
.player-inputs {
|
.player-inputs {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 20px;
|
gap: 24px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
margin-bottom: 32px;
|
||||||
}
|
}
|
||||||
.player-input {
|
.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 {
|
.player-input label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 12px;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 24px;
|
font-size: 1.2rem;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
.name-input-container {
|
.name-input-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 12px;
|
||||||
}
|
|
||||||
.name-select {
|
|
||||||
flex: 1;
|
|
||||||
padding: 30px;
|
|
||||||
border: 2px solid #333;
|
|
||||||
background: #2a2a2a;
|
|
||||||
color: white;
|
|
||||||
font-size: 24px;
|
|
||||||
min-height: 44px;
|
|
||||||
}
|
}
|
||||||
.name-input {
|
.name-input {
|
||||||
flex: 2;
|
flex: 2;
|
||||||
padding: 30px;
|
padding: 14px 12px;
|
||||||
border: 2px solid #333;
|
border: 2px solid #333;
|
||||||
background: #2a2a2a;
|
background: #2a2a2a;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 24px;
|
font-size: 1.1rem;
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
}
|
border-radius: 0 6px 6px 0;
|
||||||
.name-select:focus, .name-input:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: #666;
|
|
||||||
}
|
}
|
||||||
.game-settings {
|
.game-settings {
|
||||||
margin-top: 20px;
|
margin-top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-bottom: 32px;
|
||||||
}
|
}
|
||||||
.setting-group {
|
.setting-group {
|
||||||
margin-bottom: 20px;
|
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%;
|
width: 100%;
|
||||||
padding: 30px;
|
padding: 14px 12px;
|
||||||
border: 2px solid #333;
|
border: 2px solid #333;
|
||||||
background: #2a2a2a;
|
background: #2a2a2a;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 24px;
|
font-size: 1.1rem;
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
padding: 12px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
.setting-group input {
|
.setting-group input:focus, .setting-group select:focus {
|
||||||
width: 100%;
|
|
||||||
padding: 30px;
|
|
||||||
border: 2px solid #333;
|
|
||||||
background: #2a2a2a;
|
|
||||||
color: white;
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
.setting-group input:focus {
|
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: #666;
|
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 {
|
.nav-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 12px;
|
||||||
margin: 20px 0 40px 0;
|
margin: 16px 0 0 0;
|
||||||
}
|
}
|
||||||
.btn {
|
.btn {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
padding: 20px;
|
padding: 18px;
|
||||||
color: white;
|
color: white;
|
||||||
|
background: #333;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 6px;
|
||||||
font-size: 20px;
|
font-size: 1.2rem;
|
||||||
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
touch-action: manipulation;
|
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;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user