p5.js-web-editor/client/modules/IDE/actions/sorting.js
siddhant b7df80a96c 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-06 17:17:33 -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
};
}