Vulcan/packages/vulcan-forms/lib/FormGroup.jsx

24 lines
709 B
React
Raw Normal View History

2017-05-19 14:42:43 -06:00
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import FormComponent from "./FormComponent.jsx";
2017-05-19 14:42:43 -06:00
class FormGroup extends PureComponent {
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>}
{this.props.fields.map(field => <FormComponent key={field.name} {...field} updateCurrentValues={this.props.updateCurrentValues} />)}
</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
}
export default FormGroup;