mirror of
https://github.com/zoriya/flood.git
synced 2026-05-29 18:04:10 +00:00
Insert state into strategic components rather than entire app
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user