fix: modal overlay and game screen styling

- Move modal overlay CSS to global stylesheet for reliable overlay behavior
- Render GameCompletionModal outside main container for true overlay effect
- Refactor GameCompletionModal to use global overlay and local content styles
- Fix player score layout, color, and button styling on game detail screen
- Add global .modal and .modal.show classes to index.css
- Clean up CSS modules for modal content and responsive design

Fixes #<issue_number>
This commit is contained in:
Frank Schwenk
2025-06-06 15:56:04 +02:00
parent d81c375f1e
commit 7cb79f5ee3
6 changed files with 142 additions and 57 deletions

View File

@@ -189,13 +189,13 @@ export default function App() {
message={validation.message} message={validation.message}
onClose={closeValidation} onClose={closeValidation}
/> />
<GameCompletionModal
open={completionModal.open}
game={completionModal.game}
onConfirm={handleConfirmCompletion}
onClose={() => setCompletionModal({ open: false, game: null })}
/>
</div> </div>
<GameCompletionModal
open={completionModal.open}
game={completionModal.game}
onConfirm={handleConfirmCompletion}
onClose={() => setCompletionModal({ open: false, game: null })}
/>
<FullscreenToggle /> <FullscreenToggle />
</> </>
); );

View File

@@ -11,7 +11,7 @@ export default function GameCompletionModal({ open, game, onConfirm, onClose })
? `Unentschieden zwischen ${winners.join(' und ')}` ? `Unentschieden zwischen ${winners.join(' und ')}`
: `${winners[0]} hat gewonnen!`; : `${winners[0]} hat gewonnen!`;
return ( return (
<div className={styles['modal'] + ' ' + styles['show']} id="game-completion-modal"> <div id="game-completion-modal" className="modal show">
<div className={styles['modal-content']}> <div className={styles['modal-content']}>
<div className={styles['modal-header']}> <div className={styles['modal-header']}>
<span className={styles['modal-title']}>Spiel beendet</span> <span className={styles['modal-title']}>Spiel beendet</span>

View File

@@ -2,26 +2,24 @@
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100vw;
height: 100%; height: 100vh;
background-color: rgba(0, 0, 0, 0.7); background-color: rgba(0, 0, 0, 0.8);
z-index: 1000; z-index: 9999;
display: none; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
#game-completion-modal.show { .modal-content {
display: flex; background-color: #222;
} padding: 32px 24px 24px 24px;
#game-completion-modal .modal-content { border-radius: 16px;
background-color: #2a2a2a; width: 90vw;
padding: 30px; max-width: 480px;
border-radius: 10px; box-shadow: 0 4px 32px rgba(0,0,0,0.7);
width: 90%;
max-width: 500px;
position: relative; position: relative;
margin: auto; margin: auto;
transform: translateY(0); transform: none;
} }
.final-scores { .final-scores {
margin: 20px 0; margin: 20px 0;
@@ -30,56 +28,88 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 20px; padding: 18px 0;
margin-bottom: 10px; margin-bottom: 8px;
background: #333; background: #333;
border-radius: 5px; border-radius: 8px;
font-size: 24px; font-size: 1.2rem;
color: #fff;
} }
.final-score .player-name { .final-score .player-name {
font-size: 24px; font-size: 1.2rem;
font-weight: bold; font-weight: bold;
color: white; color: #fff;
} }
.final-score .score { .final-score .score {
font-size: 24px; font-size: 1.2rem;
font-weight: bold; font-weight: bold;
color: white; color: #fff;
} }
.winner-announcement { .winner-announcement {
text-align: center; text-align: center;
margin: 20px 0; margin: 20px 0 0 0;
padding: 20px; padding: 18px 8px;
background: #4CAF50; background: #43a047;
border-radius: 5px; border-radius: 8px;
font-size: 1.2rem;
color: #fff;
font-weight: 700;
} }
.winner-announcement h3 { .winner-announcement h3 {
font-size: 24px; font-size: 1.2rem;
margin: 0; margin: 0;
color: white; color: #fff;
} }
.modal-buttons { .modal-footer {
display: flex; display: flex;
gap: 10px; flex-direction: row;
margin-top: 20px; gap: 16px;
margin-top: 24px;
width: 100%;
justify-content: center;
} }
.modal-buttons .btn { .btn {
flex: 1; flex: 1;
padding: 20px; padding: 18px 0;
font-size: 20px; font-size: 1.1rem;
border: none; border: none;
border-radius: 0; border-radius: 8px;
cursor: pointer; cursor: pointer;
color: white; color: #fff;
background: #333;
font-weight: 600;
transition: background 0.2s;
} }
.modal-buttons .btn--warning { .btn--warning {
background: #f44336; background: #f44336;
} }
.modal-buttons .btn:not(.btn--warning) { .btn:not(.btn--warning):hover {
background: #333; background: #444;
} }
#game-completion-modal h2 { .btn--warning:hover {
font-size: 24px; background: #d32f2f;
margin-bottom: 20px; }
color: white; .close-button {
position: absolute;
top: 12px;
right: 16px;
background: none;
border: none;
color: #aaa;
font-size: 2rem;
cursor: pointer;
z-index: 2;
}
.close-button:hover {
color: #fff;
}
@media (max-width: 600px) {
.modal-content {
padding: 16px 4px 16px 4px;
max-width: 98vw;
}
.btn {
font-size: 1rem;
padding: 14px 0;
}
} }

View File

@@ -10,7 +10,7 @@ export default function GameDetail({ game, onFinishGame, onUpdateScore, onBack }
return ( return (
<div className={styles['game-detail']}> <div className={styles['game-detail']}>
<div className={styles['game-title']}>{game.gameType}{game.raceTo ? ` | Race to ${game.raceTo}` : ''}</div> <div className={styles['game-title']}>{game.gameType}{game.raceTo ? ` | Race to ${game.raceTo}` : ''}</div>
<div className={styles['player-scores']}> <div className={styles['scores-container']}>
{playerNames.map((name, idx) => ( {playerNames.map((name, idx) => (
<div className={ <div className={
styles['player-score'] + (name === 'Fränky' ? ' ' + styles['franky'] : '') styles['player-score'] + (name === 'Fränky' ? ' ' + styles['franky'] : '')

View File

@@ -37,32 +37,44 @@
.scores-container { .scores-container {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
gap: 20px; gap: 32px;
min-height: 0; min-height: 0;
} }
.player-score { .player-score {
flex: 1; flex: 1;
text-align: center; text-align: center;
padding: 20px; padding: 20px;
background-color: #333; border-radius: 16px;
border-radius: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 0; min-height: 0;
margin: 0 8px;
}
.player-score:first-child {
background-color: #43a047;
}
.player-score:nth-child(2) {
background-color: #1565c0;
}
.player-score:nth-child(3) {
background-color: #333;
} }
.player-name { .player-name {
font-size: 24px; font-size: 24px;
margin-bottom: 10px; margin-bottom: 10px;
color: #fff; color: #fff;
text-shadow: 0 2px 8px rgba(0,0,0,0.4);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.score { .score {
font-size: 50vh; font-size: 16vh;
font-weight: bold; font-weight: bold;
margin: 10px 0; margin: 10px 0 20px 0;
line-height: 1; line-height: 1;
color: #fff;
text-shadow: 0 2px 8px rgba(0,0,0,0.4);
} }
.score-buttons { .score-buttons {
display: flex; display: flex;
@@ -80,6 +92,7 @@
cursor: pointer; cursor: pointer;
transition: background-color 0.2s; transition: background-color 0.2s;
min-width: 80px; min-width: 80px;
margin-bottom: 8px;
} }
.game-controls { .game-controls {
display: flex; display: flex;
@@ -100,4 +113,30 @@
} }
.control-button.delete { .control-button.delete {
background: #f44336; background: #f44336;
}
.game-detail-controls {
display: flex;
flex-direction: row;
gap: 24px;
margin: 40px 0 0 0;
width: 100%;
justify-content: center;
}
.nav-button {
flex: 1;
min-width: 200px;
padding: 24px 0;
color: #fff;
background: #333;
border: none;
border-radius: 8px;
font-size: 1.4rem;
font-weight: 600;
cursor: pointer;
transition: background 0.2s, color 0.2s;
margin-bottom: 0;
margin-top: 0;
}
.nav-button:hover:enabled {
background: #444;
} }

View File

@@ -76,4 +76,20 @@ input, select {
.new-game-button:hover { .new-game-button:hover {
background: #333; background: #333;
}
.modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.modal.show {
display: flex;
} }