move signup form to separate file
This commit is contained in:
parent
5c3f36e671
commit
091741b974
2 changed files with 20 additions and 8 deletions
18
shared/components/SignupForm/SignupForm.jsx
Normal file
18
shared/components/SignupForm/SignupForm.jsx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
class SignupForm extends React.Component {
|
||||||
|
render() {
|
||||||
|
const {fields: { username, email, password, confirmPassword }, handleSubmit} = this.props;
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSubmit(this.props.signUpUser.bind(this))}>
|
||||||
|
<input type="text" placeholder="Username" {...username}/>
|
||||||
|
<input type="text" placeholder="Email" {...email}/>
|
||||||
|
<input type="password" placeholder="Password" {...password}/>
|
||||||
|
<input type="password" placeholder="Confirm Password" {...confirmPassword}/>
|
||||||
|
<input type="submit" value="Sign Up" />
|
||||||
|
</form>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SignupForm;
|
|
@ -3,18 +3,12 @@ import { bindActionCreators } from 'redux'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import * as UserActions from '../../redux/actions/user'
|
import * as UserActions from '../../redux/actions/user'
|
||||||
import { reduxForm } from 'redux-form'
|
import { reduxForm } from 'redux-form'
|
||||||
|
import SignupForm from '../../components/SignupForm/SignupForm'
|
||||||
|
|
||||||
class SignupView extends React.Component {
|
class SignupView extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const {fields: { username, email, password, confirmPassword }, handleSubmit} = this.props;
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(this.props.signUpUser.bind(this))}>
|
<SignupForm {...this.props} />
|
||||||
<input type="text" placeholder="Username" {...username}/>
|
|
||||||
<input type="text" placeholder="Email" {...email}/>
|
|
||||||
<input type="password" placeholder="Password" {...password}/>
|
|
||||||
<input type="password" placeholder="Confirm Password" {...confirmPassword}/>
|
|
||||||
<input type="submit" value="Sign Up" />
|
|
||||||
</form>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue