From a98eea2346927bb460ec7f70363500463e646a7a Mon Sep 17 00:00:00 2001 From: anum1608 Date: Thu, 1 Aug 2024 12:22:12 +0100 Subject: [PATCH 1/3] mm-107-startquizbutton: Add a button (nothing happens when clicked) --- src/Home/Home.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Home/Home.tsx b/src/Home/Home.tsx index aa598b1..b5cbfb4 100644 --- a/src/Home/Home.tsx +++ b/src/Home/Home.tsx @@ -29,6 +29,10 @@ function Home() { {submitStatus ?

Welcome {username}!

: null} + + ) From 67943671de0ee2d382022fbb0473690f4fa7daea Mon Sep 17 00:00:00 2001 From: anum1608 Date: Thu, 1 Aug 2024 12:26:51 +0100 Subject: [PATCH 2/3] mm-107-startquizbutton: redirect to quiz when click on Start quiz button on homepage --- src/Home/Home.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Home/Home.tsx b/src/Home/Home.tsx index b5cbfb4..7acfb95 100644 --- a/src/Home/Home.tsx +++ b/src/Home/Home.tsx @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import { useNavigate } from "react-router-dom"; import DisplayBackgroundImage from '../images/DisplayBackgroundImage'; function Home() { @@ -11,6 +12,12 @@ function Home() { setSubmitStatus(true); } + let navigate = useNavigate(); + const routeChange = () =>{ + let path = '/quiz'; + navigate(path); + } + const homeBackgroundImage = DisplayBackgroundImage(); return ( @@ -29,7 +36,7 @@ function Home() { {submitStatus ?

Welcome {username}!

: null} - From d4867f9315f56aa2c3b211d0594207a323361814 Mon Sep 17 00:00:00 2001 From: anum1608 Date: Thu, 1 Aug 2024 14:10:12 +0100 Subject: [PATCH 3/3] mm-107-startquizbutton: move username usestate in App to be able to pass username to Quiz --- src/App.tsx | 7 ++++--- src/Home/Home.test.tsx | 9 ++++++--- src/Home/Home.tsx | 16 +++++++++++----- src/Quiz/Quiz.tsx | 11 +++++++++-- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 4ddea8e..5611042 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from "react"; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import './App.scss'; import Home from './Home/Home'; @@ -9,15 +9,16 @@ import Footer from './Footer/Footer'; function App() { + const [username, setUsername] = useState(""); return (
} /> + element={} /> } /> + element={} />