Insert state into strategic components rather than entire app

This commit is contained in:
John Furrow
2015-11-08 21:34:05 -08:00
parent cf11f386d8
commit 535652d074
12 changed files with 227 additions and 126 deletions
@@ -130,10 +130,23 @@ export default class SortDropdown extends React.Component {
onItemSelect(sortBy) {
this.setState({
isExpanded: false,
sortBy
isExpanded: false
});
this.props.onSortChange(sortBy);
let direction = this.props.selectedItem.direction;
if (this.props.selectedItem.property === sortBy.property) {
direction = direction === 'asc' ? 'desc' : 'asc';
} else {
direction = 'asc';
}
let sortProperty = {
displayName: sortBy.displayName,
property: sortBy.property,
direction
};
this.props.onSortChange(sortProperty);
}
render() {