diff --git a/src/App.tsx b/src/App.tsx
index 4ddea8e..36376ad 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -19,7 +19,7 @@ function App() {
} />
-
+
);
diff --git a/src/Header/Header.tsx b/src/Header/Header.tsx
index d19c730..9a27980 100644
--- a/src/Header/Header.tsx
+++ b/src/Header/Header.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import Hamburger from '../Hamburgerbutton/Hamburgerbutton';
-const logo = require('../ImageAssets/marsiokartlogo.jpg')
+const logo = require('../ImageAssets/marsiokartlogo.png')
const Header: React.FC = () => {
const handleHamburgerClick = () => {
diff --git a/src/ImageAssets/marsiokartlogo.png b/src/ImageAssets/marsiokartlogo.png
new file mode 100644
index 0000000..13e6010
Binary files /dev/null and b/src/ImageAssets/marsiokartlogo.png differ
diff --git a/src/QuestionDisplay/QuestionDisplay.tsx b/src/QuestionDisplay/QuestionDisplay.tsx
index fa8b236..3d807ac 100644
--- a/src/QuestionDisplay/QuestionDisplay.tsx
+++ b/src/QuestionDisplay/QuestionDisplay.tsx
@@ -1,16 +1,26 @@
-import { getQuizQuestions } from "../getQuizQuestions/getQuizQuestions";
+import { getQuizQuestions, Answer, Question } from "../getQuizQuestions/getQuizQuestions";
+import { Quiz } from "../Quiz/Quiz";
-export function QuestionDisplay() {
- const questions = getQuizQuestions();
+interface QuestionDisplayProp{
+ question: Question;
+}
- const question = questions[Math.floor(Math.random() * questions.length)];
+export function QuestionDisplay(props: QuestionDisplayProp) {
+ // const questions = getQuizQuestions();
+
+ // const question = questions[Math.floor(Math.random() * questions.length)];
+
+ // function updateCurrentIndex() {
+ // setCurrentIndex(currentIndex + 1);
+ // }
return (
- {question.question}
- {question.answers[0].answer}
- {question.answers[1].answer}
- {question.answers[2].answer}
+ {props.question.question}
+ {props.question.answers[0].answer}
+ {props.question.answers[1].answer}
+ {props.question.answers[2].answer}
+ {/* */}
)
diff --git a/src/Quiz/Quiz.tsx b/src/Quiz/Quiz.tsx
index 222702f..c46c0ec 100644
--- a/src/Quiz/Quiz.tsx
+++ b/src/Quiz/Quiz.tsx
@@ -1,7 +1,35 @@
import { QuestionDisplay } from "../QuestionDisplay/QuestionDisplay"
+import { getQuizQuestions } from "../getQuizQuestions/getQuizQuestions"
+import { useState, useEffect } from "react";
+
export function Quiz () {
+ const listOfQuestions = getQuizQuestions();
+
+ const [currentIndex, setCurrentIndex] = useState(0);
+ const [buttonText, setButtonText] = useState("Next");
+
+ const question = listOfQuestions[currentIndex]
+
+ useEffect(() => {
+ if (currentIndex === listOfQuestions.length-1) {
+ setButtonText("Finish")
+ }
+ }, [currentIndex]);
+
+
+ let lastQuestion = false;
+
+ function updateCurrentIndex() {
+ if (currentIndex < listOfQuestions.length-1) {
+ setCurrentIndex(currentIndex + 1);
+ }
+ }
+
return (
-
+
+
+
+
)
}
\ No newline at end of file
diff --git a/src/getQuizQuestions/getQuizQuestions.tsx b/src/getQuizQuestions/getQuizQuestions.tsx
index 207f477..1a496b6 100644
--- a/src/getQuizQuestions/getQuizQuestions.tsx
+++ b/src/getQuizQuestions/getQuizQuestions.tsx
@@ -1,9 +1,9 @@
-type Answer = {
+export type Answer = {
answer: string,
isCorrect: boolean
}
-type Question = {
+export type Question = {
question: string,
answers: Array
}