diff --git a/src/components/formik-forms/formik-select.jsx b/src/components/formik-forms/formik-select.jsx new file mode 100644 index 000000000..392b5ad7a --- /dev/null +++ b/src/components/formik-forms/formik-select.jsx @@ -0,0 +1,62 @@ +const classNames = require('classnames'); +const PropTypes = require('prop-types'); +const React = require('react'); +import {Field} from 'formik'; + +const ValidationMessage = require('../forms/validation-message.jsx'); + +require('../forms/input.scss'); +require('../forms/row.scss'); + +const FormikSelect = ({ + className, + error, + options, + validationClassName, + ...props +}) => { + const optionsList = options.map((item, index) => ( + + )); + return ( +
+ + {optionsList} + + {error && ( + + )} +
+ ); +}; + + +FormikSelect.propTypes = { + className: PropTypes.string, + error: PropTypes.string, + // expect structure like: [ + // {value: 'US', label: 'United States'} + // {value: 'AG', label: 'Angola'} + // ... + // ] + options: PropTypes.arrayOf(PropTypes.any), + validationClassName: PropTypes.string, + value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]) +}; + +module.exports = FormikSelect;