add proptypes to signup form
This commit is contained in:
parent
2bdd682771
commit
7a07d5380d
1 changed files with 64 additions and 55 deletions
|
@ -1,59 +1,68 @@
|
||||||
import React from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
|
|
||||||
class SignupForm extends React.Component {
|
function SignupForm(props) {
|
||||||
render() {
|
const { fields: { username, email, password, confirmPassword }, handleSubmit } = props;
|
||||||
const { fields: { username, email, password, confirmPassword }, handleSubmit } = this.props;
|
return (
|
||||||
return (
|
<form className="signup-form" onSubmit={handleSubmit(props.signUpUser.bind(this))}>
|
||||||
<form className="signup-form" onSubmit={handleSubmit(this.props.signUpUser.bind(this))}>
|
<p className="signup-form__field">
|
||||||
<p className="signup-form__field">
|
<label className="signup-form__username-label" htmlFor="username">Username:</label>
|
||||||
<label className="signup-form__username-label" htmlFor="username">Username:</label>
|
<input
|
||||||
<input
|
className="signup-form__username-input"
|
||||||
className="signup-form__username-input"
|
id="username"
|
||||||
id="username"
|
type="text"
|
||||||
type="text"
|
placeholder="Username"
|
||||||
placeholder="Username"
|
{...username}
|
||||||
{...username}
|
/>
|
||||||
/>
|
</p>
|
||||||
</p>
|
<p className="signup-form__field">
|
||||||
<p className="signup-form__field">
|
<label className="signup-form__email-label" htmlFor="email">Email:</label>
|
||||||
<label className="signup-form__email-label" htmlFor="email">Email:</label>
|
<input
|
||||||
<input
|
className="signup-form__email-input"
|
||||||
className="signup-form__email-input"
|
id="email"
|
||||||
id="email"
|
type="text"
|
||||||
type="text"
|
placeholder="Email"
|
||||||
placeholder="Email"
|
{...email}
|
||||||
{...email}
|
/>
|
||||||
/>
|
</p>
|
||||||
</p>
|
<p className="signup-form__field">
|
||||||
<p className="signup-form__field">
|
<label className="signup-form__password-label" htmlFor="password">Password:</label>
|
||||||
<label className="signup-form__password-label" htmlFor="password">Password:</label>
|
<input
|
||||||
<input
|
className="signup-form__password-input"
|
||||||
className="signup-form__password-input"
|
id="password"
|
||||||
id="password"
|
type="password"
|
||||||
type="password"
|
placeholder="Password"
|
||||||
placeholder="Password"
|
{...password}
|
||||||
{...password}
|
/>
|
||||||
/>
|
</p>
|
||||||
</p>
|
<p className="signup-form__field">
|
||||||
<p className="signup-form__field">
|
<label
|
||||||
<label
|
className="signup-form__confirm-password-label"
|
||||||
className="signup-form__confirm-password-label"
|
htmlFor="confirm-password"
|
||||||
htmlFor="confirm-password"
|
>
|
||||||
>
|
Confirm Password:
|
||||||
Confirm Password:
|
</label>
|
||||||
</label>
|
<input
|
||||||
<input
|
className="signup-form__confirm-password-input"
|
||||||
className="signup-form__confirm-password-input"
|
id="confirm-password"
|
||||||
id="confirm-password"
|
type="password"
|
||||||
type="password"
|
placeholder="Confirm Password"
|
||||||
placeholder="Confirm Password"
|
{...confirmPassword}
|
||||||
{...confirmPassword}
|
/>
|
||||||
/>
|
</p>
|
||||||
</p>
|
<input type="submit" value="Sign Up" />
|
||||||
<input type="submit" value="Sign Up" />
|
</form>
|
||||||
</form>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignupForm.propTypes = {
|
||||||
|
fields: PropTypes.shape({
|
||||||
|
username: PropTypes.string.isRequired,
|
||||||
|
email: PropTypes.string.isRequired,
|
||||||
|
password: PropTypes.string.isRequired,
|
||||||
|
confirmPassword: PropTypes.string.isRequired
|
||||||
|
}).isRequired,
|
||||||
|
handleSubmit: PropTypes.func.isRequired,
|
||||||
|
signUpUser: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
export default SignupForm;
|
export default SignupForm;
|
||||||
|
|
Loading…
Reference in a new issue