2017-05-19 14:42:43 -06:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2016-06-03 11:03:36 +09:00
|
|
|
import FormComponent from "./FormComponent.jsx";
|
|
|
|
|
2017-05-19 14:42:43 -06:00
|
|
|
class FormGroup extends PureComponent {
|
2016-06-03 11:03:36 +09:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="form-section">
|
2017-05-19 14:42:43 -06:00
|
|
|
{this.props.name === 'default' ? null : <h3 className="form-section-heading">{this.props.label}</h3>}
|
2017-01-23 15:50:55 +01:00
|
|
|
{this.props.fields.map(field => <FormComponent key={field.name} {...field} updateCurrentValues={this.props.updateCurrentValues} />)}
|
2016-06-03 11:03:36 +09:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FormGroup.propTypes = {
|
2017-05-19 14:42:43 -06:00
|
|
|
name: PropTypes.string,
|
|
|
|
label: PropTypes.string,
|
|
|
|
order: PropTypes.number,
|
|
|
|
fields: PropTypes.array,
|
|
|
|
updateCurrentValues: PropTypes.func
|
2016-06-03 11:03:36 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export default FormGroup;
|