scratch-www/src/components/forms/select.jsx

34 lines
937 B
React
Raw Normal View History

var classNames = require('classnames');
2016-05-13 18:48:21 -04:00
var defaults = require('lodash.defaultsdeep');
var FRCSelect = require('formsy-react-components').Select;
var React = require('react');
2016-06-02 15:25:02 -04:00
var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC;
var inputHOC = require('./input-hoc.jsx');
require('./row.scss');
require('./select.scss');
var Select = React.createClass({
type: 'Select',
propTypes: {
},
render: function () {
var classes = classNames(
'select',
this.props.className
);
2016-05-13 18:48:21 -04:00
var props = this.props;
if (this.props.required && !this.props.value) {
props = defaults({}, this.props, {value: this.props.options[0].value});
}
return (
2016-06-23 07:27:43 -04:00
<div className={classes}>
<FRCSelect {... props} />
</div>
);
}
});
module.exports = inputHOC(defaultValidationHOC(Select));