Skip to content

Commit

Permalink
adjust styling to fit result and shapes more consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
skedwards88 committed Mar 18, 2024
1 parent 6aa0e03 commit 7101686
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/components/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ function Game({dispatchGameState, gameState}) {
></Letter>
))}
</div>
<div>
<div id="currentWord">
{gameState.playedIndexes
.map((index) => gameState.letters[index])
.join("")
.toUpperCase()}
</div>
<div>{gameState.result}</div>
{gameState.result ? (<div id="wordResult" className="fadeOut">{gameState.result}</div>) : (<></>)}


<div id="shapes">
{gameState.shapes.map((shape) => (
Expand Down
3 changes: 3 additions & 0 deletions src/logic/gameReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function gameReducer(currentGameState, payload) {
return {
...currentGameState,
playedIndexes: [playedIndex],
result: "",
};
} else if (payload.action === "addLetter") {
// exit early if a word isn't in progress
Expand Down Expand Up @@ -39,6 +40,7 @@ export function gameReducer(currentGameState, payload) {
return {
...currentGameState,
playedIndexes: newPlayedIndexes,
result: "",
};
} else if (payload.action === "removeLetter") {
// exit early if a word isn't in progress
Expand All @@ -61,6 +63,7 @@ export function gameReducer(currentGameState, payload) {
return {
...currentGameState,
playedIndexes: newPlayedIndexes,
result: "",
};
} else if (payload.action === "endWord") {
// exit early if a word isn't in progress
Expand Down
47 changes: 40 additions & 7 deletions src/styles/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ button:disabled {

#game {
grid-area: game;
display: grid;
grid-template-areas:
"board"
"currentWord"
"shapes"
;
}

#exitDaily {
Expand All @@ -114,6 +120,7 @@ button:disabled {

#board {
display: grid;
grid-area: board;
background-color: var(--dark-color);
touch-action: none;
justify-content: center;
Expand Down Expand Up @@ -155,23 +162,49 @@ button:disabled {

#shapes {
display: grid;
grid-area: shapes;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
justify-items: center;
}

.shape {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(4, 1fr);
grid-template-columns: repeat(4, 5vmin);
grid-template-rows: repeat(4, 5vmin);
margin: 10px;
}

.shapeBox {
width: 5vmin;
height: 5vmin;
gap:0;
}

.shapeBox.filled {
background-color: var(--light-color);
}

#currentWord {
grid-area: currentWord;
height: var(--default-font-size);
overflow: hidden;
justify-self: center;
align-self: center;
}

#wordResult {
grid-area: currentWord;
height: var(--default-font-size);
overflow: hidden;
justify-self: center;
align-self: center;
}

.fadeOut {
opacity: 0;
pointer-events: none;
animation-duration: 2s;
animation-name: fadeout;
}

@keyframes fadeout {
from {
opacity: 0.9;
}
}

0 comments on commit 7101686

Please sign in to comment.