mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-13 09:11:19 -05:00
f74a078afb
Most of our fields are required, so it makes more sense to display help when they are optional than to asterisk every required field
20 lines
592 B
JavaScript
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;
|
|
};
|