trc-client-core
Version:
The core of the TRC Client
43 lines (39 loc) • 1.25 kB
JSX
import React from 'react';
import Select from 'trc-client-core/src/components/Select';
import ReportActions from 'trc-client-core/src/report/ReportActions';
import UrlStore from 'bd-stampy/utils/UrlStore';
var regions = [
{value: 'ALL_REGIONS', label: 'All Regions'},
{value: 'CRO', label: 'CRO'},
{value: 'ERO', label: 'ERO'},
{value: 'NRO', label: 'NRO'},
{value: 'SRO', label: 'SRO'},
{value: 'WA', label: 'WA'}
];
var RegionSelect = React.createClass({
displayName: 'Region Select',
getInitialState: function () {
return {
region: UrlStore.getQueryParams().regionCode || 'ALL_REGIONS'
};
},
getDefaultProps: function() {
return {
name: 'regionCode'
};
},
onChange(e, details) {
this.setState({region: details.value}, ReportActions.changeRegion.bind(null, details.value));
},
render: function() {
return <Select
{...this.props}
name={this.props.name}
value={this.state.region}
clearable={false}
options={regions}
onChange={this.onChange}
></Select>;
}
});
module.exports = RegionSelect;