- Notifications
You must be signed in to change notification settings - Fork657
Fixed minor issues.#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
127 changes: 127 additions & 0 deletionsFinal/app.css
This file contains hidden or 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,127 @@ | ||
| :root { | ||
| background-color: #ecf5ff; | ||
| font-size: 62.5%; | ||
| } | ||
| * { | ||
| box-sizing: border-box; | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| margin: 0; | ||
| padding: 0; | ||
| color: #333; | ||
| } | ||
| h1, | ||
| h2, | ||
| h3, | ||
| h4 { | ||
| margin-bottom: 1rem; | ||
| } | ||
| h1 { | ||
| font-size: 5.4rem; | ||
| color: #56a5eb; | ||
| margin-bottom: 5rem; | ||
| } | ||
| h1 > span { | ||
| font-size: 2.4rem; | ||
| font-weight: 500; | ||
| } | ||
| h2 { | ||
| font-size: 4.2rem; | ||
| margin-bottom: 4rem; | ||
| font-weight: 700; | ||
| } | ||
| h3 { | ||
| font-size: 2.8rem; | ||
| font-weight: 500; | ||
| } | ||
| /* UTILITIES */ | ||
| .container { | ||
| width: 100vw; | ||
| height: 100vh; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| max-width: 80rem; | ||
| margin: 0 auto; | ||
| padding: 2rem; | ||
| } | ||
| .container > * { | ||
| width: 100%; | ||
| } | ||
| .flex-column { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
| .flex-center { | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
| .justify-center { | ||
| justify-content: center; | ||
| } | ||
| .text-center { | ||
| text-align: center; | ||
| } | ||
| .hidden { | ||
| display: none; | ||
| } | ||
| /* BUTTONS */ | ||
| .btn { | ||
| font-size: 1.8rem; | ||
| padding: 1rem 0; | ||
| width: 20rem; | ||
| text-align: center; | ||
| border: 0.1rem solid #56a5eb; | ||
| margin-bottom: 1rem; | ||
| text-decoration: none; | ||
| color: #56a5eb; | ||
| background-color: white; | ||
| } | ||
| .btn:hover { | ||
| cursor: pointer; | ||
| box-shadow: 0 0.4rem 1.4rem 0 rgba(86, 185, 235, 0.5); | ||
| transform: translateY(-0.1rem); | ||
| transition: transform 150ms; | ||
| } | ||
| .btn[disabled]:hover { | ||
| cursor: not-allowed; | ||
| box-shadow: none; | ||
| transform: none; | ||
| } | ||
| /* FORMS */ | ||
| form { | ||
| width: 100%; | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| } | ||
| input { | ||
| margin-bottom: 1rem; | ||
| width: 20rem; | ||
| padding: 1.5rem; | ||
| font-size: 1.8rem; | ||
| border: none; | ||
| box-shadow: 0 0.1rem 1.4rem 0 rgba(86, 185, 235, 0.5); | ||
| } | ||
| input::placeholder { | ||
| color: #aaa; | ||
| } |
37 changes: 37 additions & 0 deletionsFinal/end.html
This file contains hidden or 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,37 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
| <title>Congrats!</title> | ||
| <link rel="stylesheet" href="app.css" /> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <div id="end" class="flex-center flex-column"> | ||
| <h1 id="finalScore"></h1> | ||
| <form> | ||
| <input | ||
| type="text" | ||
| name="username" | ||
| id="username" | ||
| placeholder="username" | ||
| /> | ||
| <button | ||
| type="submit" | ||
| class="btn" | ||
| id="saveScoreBtn" | ||
| onclick="saveHighScore(event)" | ||
| disabled | ||
| > | ||
| Save | ||
| </button> | ||
| </form> | ||
| <a class="btn" href="/game.html">Play Again</a> | ||
| <a class="btn" href="/">Go Home</a> | ||
| </div> | ||
| </div> | ||
| <script src="end.js"></script> | ||
| </body> | ||
| </html> |
30 changes: 30 additions & 0 deletionsFinal/end.js
This file contains hidden or 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,30 @@ | ||
| const username = document.getElementById("username"); | ||
| const saveScoreBtn = document.getElementById("saveScoreBtn"); | ||
| const finalScore = document.getElementById("finalScore"); | ||
| const mostRecentScore = localStorage.getItem("mostRecentScore"); | ||
| const highScores = JSON.parse(localStorage.getItem("highScores")) || []; | ||
| const MAX_HIGH_SCORES = 5; | ||
| finalScore.innerText = mostRecentScore; | ||
| username.addEventListener("keyup", () => { | ||
| saveScoreBtn.disabled = !username.value; | ||
| }); | ||
| saveHighScore = e => { | ||
| console.log("clicked the save button!"); | ||
| e.preventDefault(); | ||
| const score = { | ||
| score: mostRecentScore, | ||
| name: username.value | ||
| }; | ||
| highScores.push(score); | ||
| highScores.sort((a, b) => b.score - a.score); | ||
| highScores.splice(5); | ||
| localStorage.setItem("highScores", JSON.stringify(highScores)); | ||
| window.location.assign("/"); | ||
| }; |
82 changes: 82 additions & 0 deletionsFinal/game.css
This file contains hidden or 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,82 @@ | ||
| .choice-container { | ||
| display: flex; | ||
| margin-bottom: 0.5rem; | ||
| width: 100%; | ||
| font-size: 1.8rem; | ||
| border: 0.1rem solid rgb(86, 165, 235, 0.25); | ||
| background-color: white; | ||
| } | ||
| .choice-container:hover { | ||
| cursor: pointer; | ||
| box-shadow: 0 0.4rem 1.4rem 0 rgba(86, 185, 235, 0.5); | ||
| transform: translateY(-0.1rem); | ||
| transition: transform 150ms; | ||
| } | ||
| .choice-prefix { | ||
| padding: 1.5rem 2.5rem; | ||
| background-color: #56a5eb; | ||
| color: white; | ||
| } | ||
| .choice-text { | ||
| padding: 1.5rem; | ||
| width: 100%; | ||
| } | ||
| .correct { | ||
| background-color: #28a745; | ||
| } | ||
| .incorrect { | ||
| background-color: #dc3545; | ||
| } | ||
| /* HUD */ | ||
| #hud { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
| .hud-prefix { | ||
| text-align: center; | ||
| font-size: 2rem; | ||
| } | ||
| .hud-main-text { | ||
| text-align: center; | ||
| } | ||
| #progressBar { | ||
| width: 20rem; | ||
| height: 4rem; | ||
| border: 0.3rem solid #56a5eb; | ||
| margin-top: 1.5rem; | ||
| } | ||
| #progressBarFull { | ||
| height: 3.4rem; | ||
| background-color: #56a5eb; | ||
| width: 0%; | ||
| } | ||
| /* LOADER */ | ||
| #loader { | ||
| border: 1.6rem solid white; | ||
| border-radius: 50%; | ||
| border-top: 1.6rem solid #56a5eb; | ||
| width: 12rem; | ||
| height: 12rem; | ||
| animation: spin 2s linear infinite; | ||
| } | ||
| @keyframes spin { | ||
| 0% { | ||
| transform: rotate(0deg); | ||
| } | ||
| 100% { | ||
| transform: rotate(360deg); | ||
| } | ||
| } |
54 changes: 54 additions & 0 deletionsFinal/game.html
This file contains hidden or 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,54 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
| <title>Quick Quiz - Play</title> | ||
| <link rel="stylesheet" href="app.css" /> | ||
| <link rel="stylesheet" href="game.css" /> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <div id="loader"></div> | ||
| <div id="game" class="justify-center flex-column hidden"> | ||
| <div id="hud"> | ||
| <div id="hud-item"> | ||
| <p id="progressText" class="hud-prefix"> | ||
| Question | ||
| </p> | ||
| <div id="progressBar"> | ||
| <div id="progressBarFull"></div> | ||
| </div> | ||
| </div> | ||
| <div id="hud-item"> | ||
| <p class="hud-prefix"> | ||
| Score | ||
| </p> | ||
| <h1 class="hud-main-text" id="score"> | ||
| 0 | ||
| </h1> | ||
| </div> | ||
| </div> | ||
| <h2 id="question"></h2> | ||
| <div class="choice-container"> | ||
| <p class="choice-prefix">A</p> | ||
| <p class="choice-text" data-number="1"></p> | ||
| </div> | ||
| <div class="choice-container"> | ||
| <p class="choice-prefix">B</p> | ||
| <p class="choice-text" data-number="2"></p> | ||
| </div> | ||
| <div class="choice-container"> | ||
| <p class="choice-prefix">C</p> | ||
| <p class="choice-text" data-number="3"></p> | ||
| </div> | ||
| <div class="choice-container"> | ||
| <p class="choice-prefix">D</p> | ||
| <p class="choice-text" data-number="4"></p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <script src="game.js"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.