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

34 lines
937 B
React
Raw Normal View History

2018-01-30 09:54:45 -05:00
var classNames = require('classnames');
var defaults = require('lodash.defaultsdeep');
var FRCSelect = require('formsy-react-components').Select;
var React = require('react');
var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC;
var inputHOC = require('./input-hoc.jsx');
require('./row.scss');
require('./select.scss');
2018-01-30 09:54:45 -05:00
var Select = React.createClass({
type: 'Select',
propTypes: {
},
render: function () {
var classes = classNames(
'select',
this.props.className
);
var props = this.props;
if (this.props.required && !this.props.value) {
props = defaults({}, this.props, {value: this.props.options[0].value});
}
return (
<div className={classes}>
<FRCSelect {... props} />
</div>
);
}
2018-01-30 09:54:45 -05:00
});
module.exports = inputHOC(defaultValidationHOC(Select));