Skip to content

Commit

Permalink
update(Filter): use class properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Feb 22, 2019
1 parent c4df6fe commit 8fc94d3
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/containers/Filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,35 @@ import { VENUES_LIST } from '../api';
import * as Actions from '../actions';

class Filter extends React.Component {
constructor(props) {
super(props);
state = {
indeterminate: true,
checkAll: false,
};

this.state = {
indeterminate: true,
checkAll: false,
};

this.onYearChange = this.onYearChange.bind(this);
this.onVenuesChange = this.onVenuesChange.bind(this);
this.onCheckAllChange = this.onCheckAllChange.bind(this);
}

onYearChange(value) {
onYearChange = (value) => {
const { filterYear } = this.props;
filterYear(value);
}
};

onVenuesChange(checkedValues) {
onVenuesChange = (checkedValues) => {
const { filterVenue } = this.props;
filterVenue(checkedValues);

this.setState({
indeterminate: !!checkedValues.length && (checkedValues.length < VENUES_LIST.length),
checkAll: checkedValues.length === VENUES_LIST.length,
});
}
};

onCheckAllChange(event) {
onCheckAllChange = (event) => {
const { filterVenue } = this.props;
filterVenue(event.target.checked ? VENUES_LIST : []);

this.setState({
indeterminate: false,
checkAll: event.target.checked,
});
}
};

render() {
const { year, venues, collapsed } = this.props;
Expand Down

0 comments on commit 8fc94d3

Please sign in to comment.