Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[1101/103429.152:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.153:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.153:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.154:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.155:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1101/103429.156:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.912:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.912:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.912:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.914:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1105/080515.915:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.175:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.177:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.177:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.177:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.178:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/082635.179:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.468:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1116/114115.472:ERROR:crash_report_database_win.cc(469)] failed to stat report
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"homepage": "http://gboyega.github.io/react-quiz-app",
"name": "react-quiz-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"gh-pages": "^2.1.1",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-scripts": "3.2.0"
"react-scripts": "3.2.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.88.1"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<link rel="stylesheet" href="../src/styles.css">
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
22 changes: 0 additions & 22 deletions src/App.css

This file was deleted.

26 changes: 0 additions & 26 deletions src/App.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

56 changes: 56 additions & 0 deletions src/components/AnimalQuiz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, {Component} from "react";
import QuestionGenerator from "../utils/QuestionGenerator";
import Question from "./Question";
import Result from "./Result";
import { Header } from 'semantic-ui-react';
import "./styles.css";


class AnimalQuiz extends Component {
constructor(){
super();
this.state = {
questionList: QuestionGenerator(),
questionIndex: 0,
score: 0
}
this.showContent = this.showContent.bind(this);
this.scoreQuestion= this.scoreQuestion.bind(this);
}

showContent(){
if(this.state.questionIndex < this.state.questionList.length){
return <Question content={this.state.questionList[this.state.questionIndex]} scoreQuestion={this.scoreQuestion} />
}
return <Result score={this.state.score} />

}

scoreQuestion(value){
console.log("score is", value);
// increase question index state
let question = this.state.questionList[this.state.questionIndex];
this.setState((state) => {
return{...state.questionIndex++}
})
// grade answer
// increase state score
if(value === question.answer){
this.setState((state) => {
return { ...state.score++ }
})
}
}

render(){
return(
<div className="main">
<div style={{height:"20px"}}></div>
<p><Header size='huge' color='blue'>How Much do you know about Animals?</Header></p>
<p><Header size='large' color='blue'>Test your knowledge here!</Header></p>
{this.showContent()}
</div>
)
}
}
export default AnimalQuiz;
22 changes: 22 additions & 0 deletions src/components/Question.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import QuestionOption from "./QuestionOption";
import { Header } from 'semantic-ui-react';

function Question (props) {
let questionBody = props.content;

const showOptions = () => {
return(
questionBody.options.map((option, i) => <QuestionOption value={option} key={i} scoreQuestion={props.scoreQuestion} />)
)
}

return(
<div>
<p><Header size='large' color='red'><p>{questionBody.question}</p></Header></p>
{showOptions()}
</div>
)
}

export default Question;
21 changes: 21 additions & 0 deletions src/components/QuestionOption.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { Header, Card } from 'semantic-ui-react';
import "./styles.css";

function QuestionOption(props){
let optionValue = props.value;

return(
<div onClick={()=> props.scoreQuestion(props.value)} className="options">
<div className="innercard">
<Header size='medium'>
<Card.Group style={{display:"inline-block"}}>
<Card color='orange' header={optionValue} />
</Card.Group>
</Header>
</div>
</div>
)
}

export default QuestionOption;
36 changes: 36 additions & 0 deletions src/components/Result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from "react";
import { Image, Header } from 'semantic-ui-react'

function Result(props){
let score = props.score;
if (score <= 2){
return(
<div>
<Header size='large' color='red'><p>You scored {score}!</p></Header>
<p><Header size='medium' color='red'><p>Better luck next time.</p></Header></p>
<Image src={"https://media.giphy.com/media/1AjEAMJqZVTzZLmkUD/giphy.gif"} size='medium' centered />
</div>

)
} else if(score > 2 && score <= 4){
return (
<div>
<Header size='large' color='red'><p>You scored {score}!</p></Header>
<Header size='medium' color='red'><p>Good try, but better luck next time.</p></Header>
<Image src={"https://media.giphy.com/media/5QW76Ww9bquHdg1fTv/giphy.gif"} size='medium' centered />
</div>

)
}
return (
<div>
<Header size='large' color='green'><p>You scored {score}!</p></Header>
<Header size='medium' color='red'><p>*Drum Roll*</p></Header>
<Header size='medium' color='green'><p>If you're not a vet, you made a wrong career choice.</p></Header>
<Image src={"https://media.giphy.com/media/vVzH2XY3Y0Ar6/giphy.gif"} size='medium' centered />
</div>

)
}

export default Result;
21 changes: 21 additions & 0 deletions src/components/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
body{
text-align: center;

}

#root{
background: linear-gradient(rgba(7, 7, 7, 0.6), rgba(7, 7, 7, 0.6)), url(https://media3.s-nbcnews.com/j/streams/2013/May/130502/6C7186838-tdy-130502-monkey-tiger-friends.fit-760w.jpg), no-repeat;
background-size: 100%;
background-position:center center;
height: 100%;
width: 100%;
}

.options{
width:40%;
margin:auto;
text-align: center;
}
.innercard{
display: inline-block;
}
13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

16 changes: 6 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import ReactDom from 'react-dom';
import AnimalQuiz from './components/AnimalQuiz';
import 'semantic-ui-css/semantic.min.css'
import "../src/components/styles.css";


ReactDOM.render(<App />, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
ReactDom.render(<AnimalQuiz />, document.getElementById("root"));
Loading