Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mm-107-startquizbuttonv2: correction made as per PR review comments #23

Merged
merged 2 commits into from
Aug 1, 2024
Merged
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
20 changes: 0 additions & 20 deletions src/Home/Home.test.tsx

This file was deleted.

9 changes: 2 additions & 7 deletions src/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { useNavigate } from "react-router-dom";
import DisplayBackgroundImage from '../images/DisplayBackgroundImage';
import './Home.scss'

interface getUserProp{
interface HomeProps{
username:string;
setUsername:(uname:string)=>void;
}

function Home(props:getUserProp) {
function Home(props:HomeProps) {

//const [username, setUsername] = useState("");
const [submitStatus, setSubmitStatus] = useState(false);

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
Expand All @@ -29,24 +28,20 @@ function Home(props:getUserProp) {
return (
<>
<main className="home-content" style={{ backgroundImage: `url(${homeBackgroundImage})` }}>

{/* Other components and content */}
<form onSubmit={handleSubmit}>
<label>Enter name:
<input type="text"
value={props.username}
//onChange={username => setUsername(username.target.value)}
onChange={(username) => {props.setUsername(username.target.value)}}
/>
</label>
<button type="submit">Submit</button>
{submitStatus ? <p>Welcome {props.username}!</p> : null}
</form>

<button className="startQuizButton" onClick={routeChange}>
Start quiz
</button>

</main>
</>
)
Expand Down
4 changes: 2 additions & 2 deletions src/Quiz/Quiz.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { QuestionDisplay } from "../QuestionDisplay/QuestionDisplay"

interface getUserProp{
interface QuizProps{
username:string;
}

export function Quiz (props:getUserProp) {
export function Quiz (props:QuizProps) {
return (
<div>
User : {props.username}
Expand Down
Loading