scratch-www/src/components/forms/input-hoc.jsx
Ray Schamp f74a078afb Add help text when a field is not required
Most of our fields are required, so it makes more sense to display help when they are optional than to asterisk every required field
2016-06-14 17:29:31 -04:00

20 lines
592 B
JavaScript

var React = require('react');
module.exports = function InputComponentMixin (Component) {
var InputComponent = React.createClass({
getDefaultProps: function () {
return {
messages: {
'general.notRequired': 'Not Required'
}
};
},
render: function () {
return (
<Component help={this.props.required ? null : this.props.messages['general.notRequired']}
{...this.props} />
);
}
});
return InputComponent;
};