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}
onClose={closeValidation}
/>
</div>
<GameCompletionModal
open={completionModal.open}
game={completionModal.game}
onConfirm={handleConfirmCompletion}
onClose={() => setCompletionModal({ open: false, game: null })}
/>
</div>
<FullscreenToggle />
</>
);

View File

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

View File

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

View File

@@ -37,32 +37,44 @@
.scores-container {
display: flex;
justify-content: space-between;
gap: 20px;
gap: 32px;
min-height: 0;
}
.player-score {
flex: 1;
text-align: center;
padding: 20px;
background-color: #333;
border-radius: 10px;
border-radius: 16px;
display: flex;
flex-direction: column;
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 {
font-size: 24px;
margin-bottom: 10px;
color: #fff;
text-shadow: 0 2px 8px rgba(0,0,0,0.4);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.score {
font-size: 50vh;
font-size: 16vh;
font-weight: bold;
margin: 10px 0;
margin: 10px 0 20px 0;
line-height: 1;
color: #fff;
text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.score-buttons {
display: flex;
@@ -80,6 +92,7 @@
cursor: pointer;
transition: background-color 0.2s;
min-width: 80px;
margin-bottom: 8px;
}
.game-controls {
display: flex;
@@ -101,3 +114,29 @@
.control-button.delete {
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

@@ -77,3 +77,19 @@ input, select {
.new-game-button:hover {
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;
}