import React from 'react'; import { kebabCase, startCase } from 'lodash'; import PropTypes from 'prop-types'; import { Alert, Col, ControlLabel, FormControl, FormGroup, HelpBlock } from '@freecodecamp/react-bootstrap'; const propTypes = { errors: PropTypes.objectOf(PropTypes.string), fields: PropTypes.objectOf( PropTypes.shape({ name: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, value: PropTypes.string.isRequired }) ).isRequired, options: PropTypes.shape({ errors: PropTypes.objectOf( PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(null)]) ), ignored: PropTypes.arrayOf(PropTypes.string), placeholder: PropTypes.bool, required: PropTypes.arrayOf(PropTypes.string), types: PropTypes.objectOf(PropTypes.string) }) }; function FormFields(props) { const { errors = {}, fields, options = {} } = props; const { ignored = [], placeholder = true, required = [], types = {} } = options; return (