mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Move FormIntl/FormNested switch from FromComponentInner to FormComponent
This commit is contained in:
parent
d0832c3c20
commit
a01ca2ab6e
2 changed files with 17 additions and 20 deletions
|
@ -293,6 +293,11 @@ class FormComponent extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
if (this.props.intlInput) {
|
||||
return <Components.FormIntl {...this.props} />;
|
||||
} else if (this.props.nestedInput){
|
||||
return <Components.FormNested {...this.props} />;
|
||||
}
|
||||
return (
|
||||
<Components.FormComponentInner
|
||||
{...this.props}
|
||||
|
|
|
@ -51,8 +51,6 @@ class FormComponentInner extends PureComponent {
|
|||
showCharsRemaining,
|
||||
charsRemaining,
|
||||
renderComponent,
|
||||
intlInput,
|
||||
nestedInput,
|
||||
} = this.props;
|
||||
|
||||
const hasErrors = errors && errors.length;
|
||||
|
@ -69,24 +67,18 @@ class FormComponentInner extends PureComponent {
|
|||
|
||||
const FormInput = this.props.formInput;
|
||||
|
||||
if (intlInput) {
|
||||
return <Components.FormIntl {...properties} />;
|
||||
} else if (nestedInput){
|
||||
return <Components.FormNested {...properties} />;
|
||||
} else {
|
||||
return (
|
||||
<div className={inputClass}>
|
||||
{instantiateComponent(beforeComponent, properties)}
|
||||
<FormInput {...properties}/>
|
||||
{hasErrors ? <Components.FieldErrors errors={errors} /> : null}
|
||||
{this.renderClear()}
|
||||
{showCharsRemaining && (
|
||||
<div className={classNames('form-control-limit', { danger: charsRemaining < 10 })}>{charsRemaining}</div>
|
||||
)}
|
||||
{instantiateComponent(afterComponent, properties)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className={inputClass}>
|
||||
{instantiateComponent(beforeComponent, properties)}
|
||||
<FormInput {...properties}/>
|
||||
{hasErrors ? <Components.FieldErrors errors={errors} /> : null}
|
||||
{this.renderClear()}
|
||||
{showCharsRemaining && (
|
||||
<div className={classNames('form-control-limit', { danger: charsRemaining < 10 })}>{charsRemaining}</div>
|
||||
)}
|
||||
{instantiateComponent(afterComponent, properties)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue