|
@@ -1,8 +1,13 @@
|
|
import React from 'react'
|
|
import React from 'react'
|
|
import { Field, reduxForm } from 'redux-form'
|
|
import { Field, reduxForm } from 'redux-form'
|
|
import Authbuttons from './authButtons'
|
|
import Authbuttons from './authButtons'
|
|
|
|
+import {regValidate} from '../../utils/regValidate'
|
|
|
|
+import {regRenderField} from '../../common/regRenderField'
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
const RegistrForm = props => {
|
|
const RegistrForm = props => {
|
|
|
|
+
|
|
const { handleSubmit, pristine, reset, postUsersData } = props
|
|
const { handleSubmit, pristine, reset, postUsersData } = props
|
|
const submit = (values) =>{
|
|
const submit = (values) =>{
|
|
values.avatar = "https://site.com"
|
|
values.avatar = "https://site.com"
|
|
@@ -14,64 +19,68 @@ const RegistrForm = props => {
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<Authbuttons />
|
|
<Authbuttons />
|
|
- <form onSubmit={handleSubmit(submit)}>
|
|
|
|
|
|
+ <form onSubmit={handleSubmit(submit)} className="form">
|
|
<div>
|
|
<div>
|
|
<div>
|
|
<div>
|
|
<Field
|
|
<Field
|
|
name="login"
|
|
name="login"
|
|
- component="input"
|
|
|
|
|
|
+ component={regRenderField}
|
|
type="text"
|
|
type="text"
|
|
placeholder="Логин"
|
|
placeholder="Логин"
|
|
|
|
+ className="input"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
<Field
|
|
<Field
|
|
name="password"
|
|
name="password"
|
|
- component="input"
|
|
|
|
|
|
+ component={regRenderField}
|
|
type="password"
|
|
type="password"
|
|
placeholder="Пароль"
|
|
placeholder="Пароль"
|
|
|
|
+ className="input"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
<Field
|
|
<Field
|
|
name="name"
|
|
name="name"
|
|
- component="input"
|
|
|
|
|
|
+ component={regRenderField}
|
|
type="text"
|
|
type="text"
|
|
placeholder="Имя"
|
|
placeholder="Имя"
|
|
|
|
+ className="input"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<Field
|
|
<Field
|
|
name="phone"
|
|
name="phone"
|
|
- component="input"
|
|
|
|
|
|
+ component={regRenderField}
|
|
type="text"
|
|
type="text"
|
|
placeholder="+380XXXXXXXX"
|
|
placeholder="+380XXXXXXXX"
|
|
|
|
+ className="input"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<Field
|
|
<Field
|
|
name="email"
|
|
name="email"
|
|
- component="input"
|
|
|
|
|
|
+ component={regRenderField}
|
|
type="email"
|
|
type="email"
|
|
placeholder="email@example.com"
|
|
placeholder="email@example.com"
|
|
|
|
+ className="input"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <button type="submit" disabled={pristine} >
|
|
|
|
|
|
+ <button type="submit" disabled={pristine} className="button">
|
|
Отправить
|
|
Отправить
|
|
</button>
|
|
</button>
|
|
- <button type="button" disabled={pristine} onClick={reset}>
|
|
|
|
|
|
+ <button type="button" disabled={pristine} onClick={reset} className="button">
|
|
Очистить поля
|
|
Очистить поля
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
-export default reduxForm({
|
|
|
|
- form: 'registrForm'
|
|
|
|
-})(RegistrForm)
|
|
|
|
|
|
+export default reduxForm({ form: 'registrForm', validate: regValidate})(RegistrForm)
|