import PropTypes from 'prop-types'; import React from 'react'; import Alert from 'Components/Alert'; import { kinds } from 'Helpers/Props'; import styles from './Form.css'; function Form(props) { const { children, validationErrors, validationWarnings, // eslint-disable-next-line no-unused-vars ...otherProps } = props; return (
{ validationErrors.length || validationWarnings.length ?
{ validationErrors.map((error, index) => { return ( {error.errorMessage} ); }) } { validationWarnings.map((warning, index) => { return ( {warning.errorMessage} ); }) }
: null } {children}
); } Form.propTypes = { children: PropTypes.node.isRequired, validationErrors: PropTypes.arrayOf(PropTypes.object).isRequired, validationWarnings: PropTypes.arrayOf(PropTypes.object).isRequired }; Form.defaultProps = { validationErrors: [], validationWarnings: [] }; export default Form;