-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into frontend/chore/deps_update
- Loading branch information
Showing
6 changed files
with
245 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { BrowserRouter as Router, Route, Switch} from 'react-router-dom'; | ||
import Main from './Main'; | ||
import Login from './components/LoginSignup/LoginSignup'; | ||
|
||
const App = () => { | ||
return ( | ||
<Router> | ||
<Switch> | ||
<Route path="/" exact component={Main} /> | ||
<Route path="/login" component={Login} /> | ||
</Switch> | ||
</Router> | ||
); | ||
}; | ||
|
||
export default App; |
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 @@ | ||
.container{ | ||
display: flex; | ||
flex-direction: column; | ||
margin: auto; | ||
margin-top: 5%; | ||
width: 60% | ||
} | ||
|
||
.inputs { | ||
margin-top: 5%; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 15px; | ||
width: 100% | ||
} | ||
|
||
.input { | ||
display: flex; | ||
align-items:center; | ||
margin: auto; | ||
width: 100%; | ||
} | ||
|
||
.input input { | ||
background: transparent; | ||
} | ||
|
||
.submit-container{ | ||
display: flex; | ||
margin: 5% auto; | ||
width: 100%; | ||
} | ||
|
||
.submit { | ||
display: flex; | ||
justify-content:center; | ||
align-items:center; | ||
margin: auto; | ||
width: 100%; | ||
} | ||
|
||
.login span{ | ||
text-decoration: underline; | ||
color: #1565c0 | ||
|
||
} | ||
|
||
.header{ | ||
display: flex; | ||
justify-content:center; | ||
|
||
} | ||
|
||
img{ | ||
width: 50%; | ||
height: auto; | ||
} |
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,99 @@ | ||
import React,{ useState } from "react"; | ||
import './LoginSignup.css' | ||
import { TextField, Button } from "@material-ui/core/" | ||
import logo from '../assets/Greenpeace_logo.png' | ||
|
||
const LoginSignup = () => { | ||
|
||
const [action, setAction] = useState("Login"); | ||
const [email, setEmail] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
const [errorPassword, setErrorPassword] = useState(false); | ||
const [errorEmail, setErrorEmail] = useState(false); | ||
|
||
|
||
const handleEmailChange = (event) => { | ||
setEmail(event.target.value); | ||
setErrorEmail(false); | ||
}; | ||
|
||
const handlePasswordChange = (event) => { | ||
setPassword(event.target.value); | ||
setErrorPassword(false); | ||
}; | ||
|
||
const handleLoginSignup = () => { | ||
//console.log(email); | ||
//console.log(password); | ||
if (email.trim() !== "" && password.trim() !== ""){ | ||
setEmail(''); | ||
setErrorEmail(false); | ||
setPassword(''); | ||
setErrorPassword(false); | ||
} else { | ||
if (email.trim() === "" && password.trim() !== ""){ | ||
setErrorEmail(true); | ||
setErrorPassword(false); | ||
} else if (password.trim() === "" && email.trim() !== "") { | ||
setErrorEmail(false); | ||
setErrorPassword(true); | ||
}else { | ||
setErrorEmail(true); | ||
setErrorPassword(true); | ||
} | ||
} | ||
}; | ||
|
||
|
||
return ( | ||
<div className="container"> | ||
<div className="header"> | ||
<img src={logo} alt="Logo" /> | ||
</div> | ||
<div className="inputs"> | ||
<div className="input"> | ||
<TextField fullWidth id="email-input" label="Email" variant="outlined" | ||
value={email} | ||
onChange={handleEmailChange} | ||
error={Boolean(errorEmail)} | ||
/> | ||
</div> | ||
<div className="input"> | ||
<TextField fullWidth id="password-input" label="Password" variant="outlined" | ||
value={password} | ||
onChange={handlePasswordChange} | ||
error={Boolean(errorPassword)} | ||
|
||
/> | ||
</div> | ||
</div> | ||
|
||
<div className="submit-container"> | ||
{action==="Login"? | ||
<div className="submit"> | ||
<Button fullWidth variant="contained" color="primary" disableElevation | ||
onClick={handleLoginSignup}> | ||
LOG IN | ||
</Button> | ||
</div>: | ||
<div className="submit"> | ||
<Button fullWidth variant="contained" color="primary" disableElevation | ||
onClick={handleLoginSignup}> | ||
SIGN UP | ||
</Button> | ||
</div> | ||
} | ||
|
||
|
||
</div> | ||
|
||
{ action==="Login"? | ||
<div className="login" onClick={()=> {setAction("Sign Up")}}>or <span>Sign Up</span></div>: | ||
<div className="login" onClick={()=> {setAction("Login")}}>or <span>Log In</span></div> | ||
} | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default LoginSignup |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.