|
@@ -3,8 +3,12 @@ import { Field, reduxForm } from 'redux-form';
|
|
|
|
|
|
import './reg-form-event.scss';
|
|
|
|
|
|
+import { customSelect } from "../customFields/customSelect/customSelect";
|
|
|
+import { customInput } from "../customFields/customInput/customInput";
|
|
|
+
|
|
|
let RegFormEvent = props => {
|
|
|
const { handleSubmit, regEventSubmit, eventId } = props;
|
|
|
+ const eventTypes = ['Select distance', 'Half marathone','Marathone'];
|
|
|
|
|
|
const submit = value => {
|
|
|
value.event = eventId;
|
|
@@ -15,36 +19,30 @@ let RegFormEvent = props => {
|
|
|
|
|
|
return (
|
|
|
<form className="form" onSubmit={handleSubmit(submit)}>
|
|
|
- <div>
|
|
|
- <label htmlFor="name">Full name</label>
|
|
|
- <Field name="name" component="input" type="text" id="name"/>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label htmlFor="phone">Phone</label>
|
|
|
- <Field name="phone" component="input" type="phone" id="phone"/>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label htmlFor="email">E-mail</label>
|
|
|
- <Field name="email" component="input" type="text" />
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label htmlFor="male">Male</label>
|
|
|
- <Field name="sex" component="input" type="radio" id="male" value="male" checked="checked"/>
|
|
|
+ <Field name="name" label="Full name" type="text" id="name" component={customInput} />
|
|
|
|
|
|
- <label htmlFor="female">female</label>
|
|
|
- <Field name="sex" component="input" type="radio" id="female" value="female"/>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label>Distance</label>
|
|
|
- <Field name="distance" component="select">
|
|
|
- <option value="Half marathone">Half marathone</option>
|
|
|
- <option value="Marathone">Marathone</option>
|
|
|
- </Field>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label htmlFor="userCountry">Country</label>
|
|
|
- <Field name="userCountry" component="input" type="text" id="userCountry"/>
|
|
|
+ <Field name="phone" label="Phone" type="phone" id="phone" component={customInput} />
|
|
|
+
|
|
|
+ <Field name="email" label="E-mail" type="email" id="email" component={customInput} />
|
|
|
+
|
|
|
+ <div className="reg-radio">
|
|
|
+ <div className="radio-label">
|
|
|
+ <Field name="sex" component="input" type="radio" id="male" value="male" hidden/>
|
|
|
+ <label htmlFor="male">male</label>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="radio-label">
|
|
|
+ <Field name="sex" component="input" type="radio" id="female" value="female" hidden/>
|
|
|
+ <label htmlFor="female">female</label>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <Field name="distance" label="Distance" component={customSelect}>
|
|
|
+ {eventTypes.map( (elem,ind) => <option key={ind} value={elem}>{elem}</option>)}
|
|
|
+ </Field>
|
|
|
+
|
|
|
+ <Field name="userCountry" label="Country" type="text" id="userCountry" component={customInput} />
|
|
|
+
|
|
|
<div className="btn-group">
|
|
|
<button className="btn" type="submit">Register</button>
|
|
|
</div>
|