diff --git a/client/src/components/App.js b/client/src/components/App.js index 3302996..02b88d4 100644 --- a/client/src/components/App.js +++ b/client/src/components/App.js @@ -25,7 +25,6 @@ export const UserContext = createContext(); function App() { const [currentUser, setCurrentUser] = useState({}); - const [avatar, setAvatar] = useState(null); const [errors, setErrors] = useState([]); const navigate = useNavigate(); @@ -154,7 +153,6 @@ function App() { value={{ currentUser, setCurrentUser, - avatar, handleLogOut, handleAddRecipe, handleUpdateRecipe, diff --git a/client/src/components/LogIn.js b/client/src/components/LogIn.js index 3cf8cb6..261e91c 100644 --- a/client/src/components/LogIn.js +++ b/client/src/components/LogIn.js @@ -2,12 +2,24 @@ import React, { useContext, useState } from "react"; import { useNavigate } from "react-router-dom"; import { UserContext } from "./App"; import Button from "@mui/material/Button"; +import CssBaseline from "@mui/material/CssBaseline"; +import TextField from "@mui/material/TextField"; +import FormControlLabel from "@mui/material/FormControlLabel"; +import Checkbox from "@mui/material/Checkbox"; +import Link from "@mui/material/Link"; +import Grid from "@mui/material/Grid"; +import Box from "@mui/material/Box"; +import LockOutlinedIcon from "@mui/icons-material/LockOutlined"; +import Typography from "@mui/material/Typography"; +import Container from "@mui/material/Container"; +import { createTheme, ThemeProvider } from "@mui/material/styles"; function LogIn() { const [login, setLogin] = useState({ username: "", password: "", }); + const theme = createTheme(); const { setCurrentUser } = useContext(UserContext); const navigate = useNavigate(); @@ -34,39 +46,60 @@ function LogIn() { } return ( - <> -

- Log in: -

-
-

Username:

- - -

Password:

- - - -
- + + + + + + Sign in + + + + + + + + + ); } diff --git a/client/src/components/SignUp.js b/client/src/components/SignUp.js index 9a10d07..eec1e10 100644 --- a/client/src/components/SignUp.js +++ b/client/src/components/SignUp.js @@ -1,11 +1,23 @@ -import { Button } from "@mui/material"; import React, { useState, useContext } from "react"; +import { Button } from "@mui/material"; import { useNavigate } from "react-router-dom"; import { UserContext } from "./App"; +import Avatar from "@mui/material/Avatar"; +import CssBaseline from "@mui/material/CssBaseline"; +import TextField from "@mui/material/TextField"; +import FormControlLabel from "@mui/material/FormControlLabel"; +import Checkbox from "@mui/material/Checkbox"; +import Link from "@mui/material/Link"; +import Grid from "@mui/material/Grid"; +import Box from "@mui/material/Box"; +import LockOutlinedIcon from "@mui/icons-material/LockOutlined"; +import Typography from "@mui/material/Typography"; +import Container from "@mui/material/Container"; +import { createTheme, ThemeProvider } from "@mui/material/styles"; function SignUp() { - const { setCurrentUser, avatar, setAvatar } = useContext(UserContext); - + const { setCurrentUser } = useContext(UserContext); + const theme = createTheme(); const [error, setError] = useState([]); const [signupForm, setSignupForm] = useState({ username: "", @@ -25,10 +37,6 @@ function SignUp() { formData.append(data, signupForm[data]); } - if (avatar !== null) { - formData.append("avatar", avatar.avatar); - } - fetch("/signup", { method: "POST", body: formData, @@ -36,7 +44,6 @@ function SignUp() { if (resp.ok) { resp.json().then((user) => { setCurrentUser(user); - // setAvatar(user.image_url); navigate("/"); }); } else { @@ -49,70 +56,88 @@ function SignUp() { setSignupForm({ ...signupForm, [e.target.name]: e.target.value }); } - function handleFileChange(e) { - setAvatar({ avatar: e.target.files[0] }); - } - return ( -
-

- Join now and get cooking! -

-
-

Username

- - -

Password

- -

- Your password must be 8-20 characters long, contain letters and - numbers, and must not contain spaces, special characters, or emoji. -

- -

Confirm password

- - -

Name

- - -

Upload an avatar (optional):

- - - - {/* {error.map((err) => { - return

{err}

; - })} */} -
-
+ + + + + + Join now and get cooking! + + + + + + + + + + + + + + + + + + + + + ); }