-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
20 changed files
with
584 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,205 @@ | ||
import React, { Component } from 'react' | ||
import './signup.css' | ||
import axios from 'axios' | ||
|
||
class Signup extends Component { | ||
state = { | ||
name: '', | ||
email: '', | ||
password: '', | ||
confirmPassword: '', | ||
displayBio: false, | ||
type: '', | ||
availability: '', | ||
photo: '', | ||
age: '', | ||
description: '', | ||
phone: '', | ||
userType: 'user' | ||
} | ||
onChange = event => { | ||
this.setState({ | ||
[event.target.name]: event.target.value | ||
}) | ||
} | ||
|
||
ShowDisplayBio = () => { | ||
this.setState({ displayBio: true, userType: 'guide' }) | ||
} | ||
|
||
displayShorterBio = () => { | ||
this.setState({ displayBio: false }) | ||
} | ||
|
||
validatePassword = () => { | ||
return ( | ||
this.state.password.length > 6 && | ||
this.state.password === this.state.confirmPassword | ||
) | ||
} | ||
|
||
pressButton = event => { | ||
const { | ||
email, | ||
name, | ||
password, | ||
type, | ||
availability, | ||
photo, | ||
age, | ||
phone, | ||
description, | ||
userType | ||
} = this.state | ||
axios | ||
.post('/api/signup', { | ||
name, | ||
email, | ||
password, | ||
type, | ||
photo, | ||
description, | ||
availability, | ||
phone, | ||
age, | ||
userType | ||
}) | ||
.then(result => console.log(result.data, 'ax')) | ||
} | ||
|
||
render() { | ||
return ( | ||
<> | ||
<h1>Signup</h1> | ||
|
||
<form> | ||
<input | ||
type="text" | ||
name="name" | ||
onChange={this.onChange} | ||
placeholder="Name..." | ||
value={this.state.name} | ||
required | ||
/> | ||
|
||
<input | ||
type="email" | ||
name="email" | ||
onChange={this.onChange} | ||
placeholder="Email..." | ||
value={this.state.email} | ||
required | ||
/> | ||
|
||
<input | ||
type="password" | ||
name="password" | ||
onChange={this.onChange} | ||
placeholder="Password..." | ||
value={this.state.password} | ||
required | ||
/> | ||
|
||
<input | ||
type="password" | ||
name="confirmPassword" | ||
onChange={this.onChange} | ||
placeholder="Confirm your password..." | ||
value={this.state.confirmPassword} | ||
required | ||
/> | ||
{!this.validatePassword() ? ( | ||
<div> | ||
<p className="validate"> | ||
{' '} | ||
your password must be than 7 character an be same of your | ||
confirm password | ||
</p> | ||
</div> | ||
) : ( | ||
<div> | ||
<p className="TrueValidate"> | ||
{' '} | ||
your password equal confirm password | ||
</p> | ||
</div> | ||
)} | ||
|
||
<div className="container"> | ||
<fieldset> | ||
<p>If you signup as a guide</p> | ||
<p> please press guide button and fill the other section</p> | ||
<button onClick={this.ShowDisplayBio}>Guide</button> | ||
<button onClick={this.displayShorterBio}>Tourist</button> | ||
</fieldset> | ||
</div> | ||
|
||
{this.state.displayBio ? ( | ||
<div className="extra"> | ||
<input | ||
type="text" | ||
name="type" | ||
onChange={this.onChange} | ||
value={this.state.type} | ||
placeholder="Language..." | ||
required | ||
/> | ||
|
||
<input | ||
type="text" | ||
name="photo" | ||
onChange={this.onChange} | ||
value={this.state.photo} | ||
placeholder="Add your photo..." | ||
required | ||
/> | ||
|
||
<input | ||
type="text" | ||
name="description" | ||
onChange={this.onChange} | ||
value={this.state.description} | ||
placeholder="Description about yourself..." | ||
required | ||
/> | ||
|
||
<input | ||
type="text" | ||
name="availability" | ||
onChange={this.onChange} | ||
value={this.state.availability} | ||
placeholder="Availability time..." | ||
required | ||
/> | ||
<input | ||
type="text" | ||
name="phone" | ||
onChange={this.onChange} | ||
value={this.state.phone} | ||
placeholder="Phone number..." | ||
required | ||
/> | ||
|
||
<input | ||
type="text" | ||
name="age" | ||
onChange={this.onChange} | ||
value={this.state.age} | ||
placeholder="Age..." | ||
required | ||
/> | ||
</div> | ||
) : ( | ||
<div></div> | ||
)} | ||
<br /> | ||
<button className="signup" type="submit" onClick={this.pressButton}> | ||
Signup | ||
</button> | ||
</form> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default Signup |
Oops, something went wrong.