-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Souviksamanta34
committed
Oct 4, 2024
1 parent
7cd33f7
commit d1c9077
Showing
6 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className='register'> | ||
<Link to='/'> | ||
<img | ||
className="register__logo" | ||
src='https://i.ibb.co/9q1pG9C/logo-removebg-preview.png' | ||
alt="Gruham Logo" | ||
/> | ||
</Link> | ||
|
||
<div className='register__container'> | ||
<h1>Create an Account</h1> | ||
|
||
<form> | ||
<h5>E-mail</h5> | ||
<input type='text' value={email} onChange={e => setEmail(e.target.value)} /> | ||
|
||
<h5>Password</h5> | ||
<input type='password' value={password} onChange={e => setPassword(e.target.value)} /> | ||
|
||
<button type='submit' onClick={register} className='register__registerButton'> | ||
Create Account | ||
</button> | ||
</form> | ||
|
||
<p> | ||
By creating an account, you agree to the Gruham Conditions of Use & Sale. | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Register; |