diff --git a/public/manifest.json b/public/manifest.json index 080d6c7..ffda840 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -10,12 +10,12 @@ { "src": "logo192.png", "type": "image/png", - "sizes": "192x192" + "sizes": "142x140" }, { "src": "logo512.png", "type": "image/png", - "sizes": "512x512" + "sizes": "142x140" } ], "start_url": ".", diff --git a/src/App.js b/src/App.js index 7f70ab4..633daa4 100644 --- a/src/App.js +++ b/src/App.js @@ -11,6 +11,7 @@ import Payment from "./Payment"; import Orders from "./Orders"; import Header from "./Header"; import Login from "./Login"; +import Register from "./Register"; import Checkout from "./Checkout"; import Product from "./Product"; import "./App.css"; @@ -64,6 +65,7 @@ function App() { } /> } /> + } /> } />
- + {basket?.length}
diff --git a/src/Login.js b/src/Login.js index 6a77dd4..db18c3e 100644 --- a/src/Login.js +++ b/src/Login.js @@ -95,7 +95,10 @@ function Login() { see our Privacy Notice, our Cookies Notice and our Interest-Based Ads Notice.

- + + ); diff --git a/src/Register.css b/src/Register.css new file mode 100644 index 0000000..3dee3a6 --- /dev/null +++ b/src/Register.css @@ -0,0 +1,57 @@ +.register { + background-color: white; + height: 100vh; + display: flex; + flex-direction: column; + align-items: center; +} + +.register__logo { + margin-top: 20px; + margin-bottom: 20px; + object-fit: contain; + width: 200px; + margin-right: auto; + margin-left: auto; +} + +.register__container { + width: 300px; + height: fit-content; + display: flex; + flex-direction: column; + border-radius: 5px; + border: 1px solid lightgray; + padding: 20px; +} + +.register__container > h1 { + font-weight: 500; + margin-bottom: 20px; +} + +.register__container > form > h5 { + margin-bottom: 5px; +} + +.register__container > form > input { + height: 30px; + margin-bottom: 10px; + background-color: white; + width: 98%; +} + +.register__registerButton { + background-color: #f0c14b; + border-radius: 2px; + width: 100%; + height: 30px; + border: 1px solid; + margin-top: 10px; + border-color: #a88734 #9c7e31 #846a29; +} + +.register__container > p { + margin-top: 15px; + font-size: 12px; +} diff --git a/src/Register.js b/src/Register.js new file mode 100644 index 0000000..8a90075 --- /dev/null +++ b/src/Register.js @@ -0,0 +1,64 @@ +import React, { useState } from 'react'; +import { Link, useNavigate } from "react-router-dom"; +import { auth } from "./firebase"; +import './Register.css'; +import { useStateValue } from './StateProvider'; + +function Register() { + const navigate = useNavigate(); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [{}, dispatch] = useStateValue(); + + const register = e => { + e.preventDefault(); + + // Firebase registration logic + auth + .createUserWithEmailAndPassword(email, password) + .then((auth) => { + if (auth) { + dispatch({ + type: 'SET_USER', + user: auth.user, // Send the registered user's info + }); + navigate('/'); + } + }) + .catch(error => alert(error.message)); + } + + return ( +
+ + Gruham Logo + + +
+

Create an Account

+ +
+
E-mail
+ setEmail(e.target.value)} /> + +
Password
+ setPassword(e.target.value)} /> + + +
+ +

+ By creating an account, you agree to the Gruham Conditions of Use & Sale. +

+
+
+ ); +} + +export default Register;