p5.js-web-editor/client/modules/IDE/actions/sorting.js
siddhant 8caeb0d439 Add sorting to sketches #789 (#910)
* reselect added

* Added Reselect Sorting

* Refactor App

* added svgs

* Refactor

* Fixed Issues

* re: #789, update sorting styling, create sorting actions and reducers, add sort by sketch name

* re #789, change names of svg icons

* re: #789, use orderBy instead of sortBy, fix styling jumps
2019-06-11 17:47:14 -04:00

27 lines
478 B
JavaScript

import * as ActionTypes from '../../../constants';
export const DIRECTION = {
ASC: 'ASCENDING',
DESC: 'DESCENDING'
};
export function setSorting(field, direction) {
return {
type: ActionTypes.SET_SORTING,
payload: {
field,
direction
}
};
}
export function resetSorting() {
return setSorting('createdAt', DIRECTION.DESC);
}
export function toggleDirectionForField(field) {
return {
type: ActionTypes.TOGGLE_DIRECTION,
field
};
}