Skip to content

Commit

Permalink
added code to conditionally render correct/incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
meierj423 committed Aug 24, 2020
1 parent a341432 commit 7b044b4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion client/src/components/Quiz/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function Quiz() {
countryArr.current[Math.floor(Math.random() * countryArr.current.length)];
if (questionCount <= 5) {
quizArr.push(randomCountry);
console.log(quizArr);
}
answerList.push(answerFromMap);
setCountry(randomCountry);
Expand Down
1 change: 0 additions & 1 deletion client/src/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function Home() {
let data = "Continent Not Found";
if (results.length !== 0 && results.length !== "undefined") {
for (let i=0;i< results.length;i++){
console.log("continent",continent)
let result = results[i];
if(result.hasOwnProperty(continent)){
data = "Continent Found"
Expand Down
14 changes: 8 additions & 6 deletions client/src/pages/Results/ResultCard.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import React from "react";
import ResultsFacts from "./ResultsFacts";

function ResultCard(props) {
console.log(props);

function ResultCard({ country, status }) {
return (
<div className="col-sm-2 title-container p-3 m-3">
<div className="card">
<div className="card-body">
<h5 className="card-title">{props.country}</h5>
<span className="badge badge-pill badge-success">Correct</span>
<ResultsFacts country={props.country} />
<h5 className="card-title">{country}</h5>
{status === "Correct" ? (
<span className="badge badge-pill badge-success">Correct</span>
) : (
<span className="badge badge-pill badge-danger">Incorrect</span>
)}
<ResultsFacts country={country} />
</div>
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions client/src/pages/Results/Results.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ function Results(props) {
let status = "Incorrect";
for (let i = 1; i < guessedCountries.length; i++) {
let countryStatus = guessedCountries[i];
console.log("guessedList", guessedCountries);
console.log(country, countryStatus[country]);
if (countryStatus[country] === "Correct") {
status = "Correct";
return "Correct";
Expand Down

0 comments on commit 7b044b4

Please sign in to comment.