Skip to content

Commit

Permalink
Merge branch 'main' into mm-009-style-form
Browse files Browse the repository at this point in the history
  • Loading branch information
natashabuckham authored Aug 1, 2024
2 parents 3f16c31 + 07f9e43 commit 7cae3c7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
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 className="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
2 changes: 1 addition & 1 deletion src/Menu/MenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// list of the menu options that will be displayed when clicking on hamburger button
export const menuItems = [
{ label: 'Home', link: '/' },
{ label: 'Quiz', link: '' },
{ label: 'Quiz', link: '/quiz' },
];
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

0 comments on commit 7cae3c7

Please sign in to comment.