-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
187 additions
and
92 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.dialog { | ||
z-index: 100; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.settings-container { | ||
justify-content: start; | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useContext } from 'react'; | ||
import { Difficulty, GameContext } from '../../contexts/gameContext'; | ||
import { Dialog } from '../Dialog'; | ||
import './GameSettings.css'; | ||
|
||
export const GameSettings = ({ onClose }: { onClose: () => void }) => { | ||
const { difficulty, setDifficulty } = useContext(GameContext); | ||
|
||
const handleChangeDifficulty = ( | ||
event: React.ChangeEvent<HTMLSelectElement> | ||
) => { | ||
const newValue = event.target.value; | ||
setDifficulty(newValue as Difficulty); | ||
}; | ||
|
||
return ( | ||
<Dialog centerX centerY onClose={onClose}> | ||
<div className="settings-container"> | ||
<label>Choose your difficulty:</label> | ||
|
||
<select | ||
name="difficulty" | ||
id="difficulty" | ||
value={difficulty} | ||
onChange={handleChangeDifficulty} | ||
> | ||
<option value={Difficulty.EASY}>Easy</option> | ||
<option value={Difficulty.MEDIUM}>Medium</option> | ||
<option value={Difficulty.HARD}>Hard</option> | ||
</select> | ||
|
||
<button | ||
className="button" | ||
onClick={() => { | ||
onClose(); | ||
}} | ||
> | ||
Let's Play! | ||
</button> | ||
</div> | ||
</Dialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ | |
|
||
> div.header-links { | ||
justify-content: end; | ||
& > * { | ||
& > a, | ||
& > .link-alike { | ||
margin-left: 1rem; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.scoreboard-container { | ||
display: flex; | ||
justify-content: center; | ||
width: 100%; | ||
padding-top: 0.5rem; | ||
} | ||
|
||
.scoreboard { | ||
display: block; | ||
padding: 0 0.5rem; | ||
width: var(--scoreboard-width); | ||
} | ||
|
||
.scoreboard .row { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
} | ||
|
||
.scoreboard p { | ||
margin: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useContext } from 'react'; | ||
import { GameContext } from '../../contexts/gameContext'; | ||
import './Scoreboard.css'; | ||
|
||
export const Scoreboard = () => { | ||
const { duration, score, attempts } = useContext(GameContext); | ||
return ( | ||
<div className="scoreboard-container"> | ||
<div className="scoreboard"> | ||
<p className="time"> | ||
<strong>Time spent:</strong> {duration} | ||
</p> | ||
<div className="row"> | ||
<p className="attempts"> | ||
<strong>Picket signs flipped:</strong> {score} | ||
</p> | ||
<p className="score"> | ||
<strong>Matches:</strong> {attempts} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.