-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add nicer score indicators and instructions page
- Loading branch information
1 parent
a2cb811
commit 94e8ade
Showing
10 changed files
with
170 additions
and
41 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import styles from "../styles/instructions.module.scss"; | ||
import Button from "./button"; | ||
import Score from "./score"; | ||
|
||
interface Props { | ||
highscore: number; | ||
start: () => void; | ||
} | ||
|
||
export default function Instructions(props: Props) { | ||
const { highscore, start } = props; | ||
|
||
return ( | ||
<div className={styles.instructions}> | ||
<div className={styles.wrapper}> | ||
<h2>Place the cards on the timeline in the correct order.</h2> | ||
<div className={styles.highscoreWrapper}> | ||
<Score score={highscore} title="Best streak" /> | ||
</div> | ||
<Button onClick={start} text="Start game!" /> | ||
</div> | ||
</div> | ||
); | ||
} |
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,28 @@ | ||
import React from "react"; | ||
import styles from "../styles/score.module.scss"; | ||
|
||
interface Props { | ||
score: number; | ||
title: string; | ||
} | ||
|
||
export default function Score(props: Props) { | ||
const { score, title } = props; | ||
|
||
let backgroundColor = "#ffffff"; | ||
|
||
if (score >= 20) { | ||
backgroundColor = "#FFC940"; | ||
} else if (score >= 10) { | ||
backgroundColor = "#A7B6C2"; | ||
} else if (score >= 1) { | ||
backgroundColor = "#C99765"; | ||
} | ||
|
||
return ( | ||
<div className={styles.score} style={{ backgroundColor }}> | ||
<div className={styles.title}>{title}</div> | ||
<div className={styles.value}>{score}</div> | ||
</div> | ||
); | ||
} |
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,24 @@ | ||
@import "./variables.scss"; | ||
|
||
.instructions { | ||
display: flex; | ||
height: calc(100% - 100px); | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
.wrapper { | ||
padding: 0 20px; | ||
text-align: center; | ||
|
||
h2 { | ||
color: $text-light; | ||
font-style: italic; | ||
text-transform: uppercase; | ||
} | ||
|
||
.highscoreWrapper { | ||
margin: 40px 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,22 @@ | ||
@import "./variables.scss"; | ||
|
||
.score { | ||
display: inline-block; | ||
transform: skewX(-12deg); | ||
border-radius: $box-border-radius; | ||
padding: 10px 24px; | ||
text-align: left; | ||
width: 140px; | ||
|
||
.title { | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
margin-bottom: 5px; | ||
white-space: nowrap; | ||
} | ||
|
||
.value { | ||
font-weight: 700; | ||
font-size: 24px; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -9,3 +9,4 @@ $incorrect: #990000; | |
$correct: #339966; | ||
$primary: #006699; | ||
$box-border-radius: 8px; | ||
$button-border-radius: 20px; |