Skip to content

Commit

Permalink
#10 Add handleChange and values to form
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 21, 2023
1 parent 2d482cc commit 0bfcd28
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/pages/auth/SignUpForm.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import React from "react";
import React, { useState } from "react";
import { Link } from "react-router-dom";

import styles from "../../styles/SignInUpForm.module.css";
import btnStyles from "../../styles/Button.module.css";
import appStyles from "../../App.module.css";

import { Form, Button, Image, Col, Row, Container } from "react-bootstrap";
import { useHistory } from "react-router-dom";

const SignUpForm = () => {
const [signUpData, setSignUpData] = useState({
username: "",
password1: "",
password2: "",
});
const { username, password1, password2 } = signUpData;

const handleChange = (event) => {
setSignUpData({
...signUpData,
[event.target.name]: event.target.value,
});
};

return (
<Row className={styles.Row}>
<Col
Expand All @@ -32,6 +47,8 @@ const SignUpForm = () => {
type="text"
placeholder="Username"
name="username"
value={username}
onChange={handleChange}
/>
</Form.Group>

Expand All @@ -42,6 +59,8 @@ const SignUpForm = () => {
type="password"
placeholder="Password"
name="password1"
value={password1}
onChange={handleChange}
/>
</Form.Group>

Expand All @@ -52,13 +71,13 @@ const SignUpForm = () => {
type="password"
placeholder="Confirm password"
name="password2"
value={password2}
onChange={handleChange}
/>
</Form.Group>

<Button
className={
`${btnStyles.Button} ${btnStyles.Wide} ${btnStyles.Bright}`
}
className={`${btnStyles.Button} ${btnStyles.Wide} ${btnStyles.Bright}`}
type="submit"
>
Sign up!
Expand Down

0 comments on commit 0bfcd28

Please sign in to comment.