+ client: add multiple fields client form

This commit is contained in:
Ildar Kamalov
2019-11-28 14:47:06 +03:00
committed by Simon Zolin
parent fd26af2677
commit a6d6e9ec9e
10 changed files with 220 additions and 135 deletions

View File

@@ -29,6 +29,50 @@ export const renderField = ({
</Fragment>
);
export const renderGroupField = ({
input,
id,
className,
placeholder,
type,
disabled,
autoComplete,
isActionAvailable,
removeField,
meta: { touched, error },
}) => (
<Fragment>
<div className="input-group">
<input
{...input}
id={id}
placeholder={placeholder}
type={type}
className={className}
disabled={disabled}
autoComplete={autoComplete}
/>
{isActionAvailable &&
<span className="input-group-append">
<button
type="button"
className="btn btn-secondary btn-icon"
onClick={removeField}
>
<svg className="icon icon--close">
<use xlinkHref="#cross" />
</svg>
</button>
</span>
}
</div>
{!disabled &&
touched &&
(error && <span className="form__message form__message--error">{error}</span>)}
</Fragment>
);
export const renderRadioField = ({
input, placeholder, disabled, meta: { touched, error },
}) => (
@@ -102,6 +146,7 @@ export const renderServiceField = ({
</Fragment>
);
// Validation functions
export const required = (value) => {
if (value || value === 0) {
return false;