scratch-www/src/components/formik-forms/formik-input.jsx

53 lines
1.1 KiB
React
Raw Normal View History

const classNames = require('classnames');
const PropTypes = require('prop-types');
const React = require('react');
import {Field} from 'formik';
const ValidationMessage = require('../forms/validation-message.jsx');
2019-08-01 15:40:46 -04:00
require('./input.scss');
require('../forms/input.scss');
require('../forms/row.scss');
const FormikInput = ({
className,
error,
2019-07-12 11:39:04 -04:00
validationClassName,
wrapperClassName,
...props
}) => (
<div
className={classNames(
'col-sm-9',
'row',
'row-with-tooltip',
wrapperClassName
)}
>
<Field
className={classNames(
'input',
className
)}
{...props}
/>
{error && (
2019-07-12 11:39:04 -04:00
<ValidationMessage
className={validationClassName}
message={error}
/>
)}
</div>
);
FormikInput.propTypes = {
className: PropTypes.string,
error: PropTypes.string,
2019-07-12 11:39:04 -04:00
type: PropTypes.string,
validationClassName: PropTypes.string,
wrapperClassName: PropTypes.string
};
module.exports = FormikInput;