Vulcan/packages/nova-forms/lib/FormGroup.jsx
xavcz 1e2d43662d form api, embedly url, fix posts autovalues
- Form API: updateCurrentValue(fieldName, fieldValue) => updateCurrentValues(newValues: {[fieldName]: fieldValue}) to update one or more fields at once;
- changes on EmbedlyURL: use of currentValues instead of autofilledValues, fix the use of 'media' field on new & edit (assigned server-side in async callback)
- fix Posts schema's autoValue logic: moved to callbacks (it worked on new docs but not triggered on edits)
2017-01-23 15:50:55 +01:00

23 lines
No EOL
706 B
JavaScript

import React, { PropTypes, Component } from 'react';
import FormComponent from "./FormComponent.jsx";
class FormGroup extends Component {
render() {
return (
<div className="form-section">
{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 = {
name: React.PropTypes.string,
label: React.PropTypes.string,
order: React.PropTypes.number,
fields: React.PropTypes.array,
updateCurrentValues: React.PropTypes.func
}
export default FormGroup;