Remove Input.fieldComponent usage

This commit is contained in:
Kimmo Puputti 2017-06-16 15:38:17 +03:00
parent d25abdbddd
commit 904a1aec1e
7 changed files with 9 additions and 32 deletions

View file

@ -23,21 +23,4 @@ Input.propTypes = {
inline: bool,
};
/*
Creates a new Input component for Redux Form Field.
Usage:
```
<Field name="password" type="password" component={Input.fieldComponent} />
```
*/
Input.fieldComponent = props => {
/* eslint-disable react/prop-types */
const { input, type } = props;
/* eslint-enable react/prop-types */
return <Input type={type} {...input} />;
};
export default Input;

View file

@ -1,17 +1,17 @@
import React from 'react';
import { Field, reduxForm, propTypes as formPropTypes } from 'redux-form';
import { Button, Input } from '../../components';
import { Button } from '../../components';
const ChangeAccountPasswordForm = props => {
const { handleSubmit, pristine, submitting } = props;
return (
<form onSubmit={handleSubmit}>
<label htmlFor="newPassword1">New password</label>
<Field name="newPassword1" component={Input.fieldComponent} type="password" />
<Field name="newPassword1" component="input" type="password" />
<label htmlFor="newPassword2">New password, again</label>
<Field name="newPassword2" component={Input.fieldComponent} type="password" />
<Field name="newPassword2" component="input" type="password" />
<label htmlFor="password">Current password</label>
<Field name="password" component={Input.fieldComponent} type="password" />
<Field name="password" component="input" type="password" />
<p>Delete account (module)</p>
<Button type="submit" disabled={pristine || submitting}>Save changes</Button>
</form>

View file

@ -6,7 +6,6 @@ exports[`ChangeAccountPasswordForm matches snapshot 1`] = `
New password
</label>
<input
className=""
name="newPassword1"
onBlur={[Function]}
onChange={[Function]}
@ -20,7 +19,6 @@ exports[`ChangeAccountPasswordForm matches snapshot 1`] = `
New password, again
</label>
<input
className=""
name="newPassword2"
onBlur={[Function]}
onChange={[Function]}
@ -34,7 +32,6 @@ exports[`ChangeAccountPasswordForm matches snapshot 1`] = `
Current password
</label>
<input
className=""
name="password"
onBlur={[Function]}
onChange={[Function]}

View file

@ -1,15 +1,15 @@
import React from 'react';
import { Field, reduxForm, propTypes as formPropTypes } from 'redux-form';
import { Button, Input } from '../../components';
import { Button } from '../../components';
const ChangePasswordForm = props => {
const { handleSubmit, pristine, submitting } = props;
return (
<form onSubmit={handleSubmit}>
<label htmlFor="newPassword1">New password</label>
<Field name="newPassword1" component={Input.fieldComponent} type="password" />
<Field name="newPassword1" component="input" type="password" />
<label htmlFor="newPassword2">New password, again</label>
<Field name="newPassword2" component={Input.fieldComponent} type="password" />
<Field name="newPassword2" component="input" type="password" />
<Button type="submit" disabled={pristine || submitting}>Change password</Button>
</form>
);

View file

@ -6,7 +6,6 @@ exports[`ChangePasswordForm matches snapshot 1`] = `
New password
</label>
<input
className=""
name="newPassword1"
onBlur={[Function]}
onChange={[Function]}
@ -20,7 +19,6 @@ exports[`ChangePasswordForm matches snapshot 1`] = `
New password, again
</label>
<input
className=""
name="newPassword2"
onBlur={[Function]}
onChange={[Function]}

View file

@ -1,13 +1,13 @@
import React from 'react';
import { Field, reduxForm, propTypes as formPropTypes } from 'redux-form';
import { Button, Input } from '../../components';
import { Button } from '../../components';
const PasswordForgottenForm = props => {
const { handleSubmit, pristine, submitting } = props;
return (
<form onSubmit={handleSubmit}>
<label htmlFor="email">Email</label>
<Field name="email" component={Input.fieldComponent} type="email" />
<Field name="email" component="input" type="email" />
<p>We will send you instructions to your email.</p>
<Button type="submit" disabled={pristine || submitting}>Send</Button>
</form>

View file

@ -6,7 +6,6 @@ exports[`PasswordForgottenForm matches snapshot 1`] = `
Email
</label>
<input
className=""
name="email"
onBlur={[Function]}
onChange={[Function]}