-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from kirontoo/feature/issue-29/client-side-sig…
…nup-login add signup page (#29)
- Loading branch information
Showing
4 changed files
with
108 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.signup-page { | ||
display: flex; | ||
flex-direction: row; | ||
height: calc( 100vh - 70px ); | ||
width: 100%; | ||
background: white; | ||
} | ||
|
||
.side-image { | ||
width: 50%; | ||
height: 100%; | ||
background: #c4c4c4; | ||
} | ||
|
||
.signup { | ||
margin: 0; | ||
height: 100%; | ||
width: 50%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.signup-form { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
gap: 1em; | ||
} | ||
|
||
.signup-form-button { | ||
width: 10em; | ||
border: none; | ||
background: #c4c4c4; | ||
padding: 0.5em 0.5em; | ||
cursor: pointer; | ||
} | ||
|
||
.signup-form-button:hover { | ||
background: #444444; | ||
color: white; | ||
font-weight: bold; | ||
} | ||
|
||
.signup-form-input { | ||
border-radius: 0; | ||
border: 1px solid black; | ||
padding: 0.5em; | ||
} |
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,51 @@ | ||
import React, { | ||
ChangeEvent, | ||
FormEvent, | ||
useState | ||
} from "react"; | ||
|
||
import "./Signup.css"; | ||
|
||
const Signup = () => { | ||
const formState = { | ||
email: '', | ||
password: '' | ||
}; | ||
|
||
const [form, setForm] = useState(formState); | ||
|
||
const handleChange = (event: ChangeEvent<HTMLInputElement>) => { | ||
const { name, value } = event.target; | ||
setForm( prevState => ({ | ||
...prevState, | ||
[name]: value | ||
})); | ||
}; | ||
|
||
const handleSubmit = (event: FormEvent<HTMLFormElement>) => { | ||
// prevent page reload | ||
event.preventDefault() | ||
// request to server create a new user here | ||
console.log(form); | ||
} | ||
|
||
return ( | ||
<main className="signup-page"> | ||
<aside className="side-image">some content goes here</aside> | ||
<section className="signup"> | ||
<h1>Signup</h1> | ||
<div className="signup-container"> | ||
<form className="signup-form" onSubmit={handleSubmit}> | ||
<label htmlFor="email">Email</label> | ||
<input className="signup-form-input" id="email" type="email" name="email" onChange={handleChange}/> | ||
<label htmlFor="password">Password</label> | ||
<input className="signup-form-input" id="password" name="password" type="password" onChange={handleChange}/> | ||
<button className="signup-form-button" type="submit">Signup</button> | ||
</form> | ||
</div> | ||
</section> | ||
</main> | ||
) | ||
}; | ||
|
||
export { Signup }; |
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 @@ | ||
export { Signup as default } from "./Signup"; |