PluginProbe
Leadpages / trunk
Leadpages vtrunk
1.3.0 1.2.1 1.2.2 1.2.3 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0
leadpages / src / utils / sorting.ts

sorting.ts in Leadpages trunk, at src/utils/sorting.ts

17 lines 520 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import type { LandingPage } from '../components/PageTable';
2 import type { Direction, OrderBy } from '../types/table';
3
4 export const handleSortChange = (
5 column: keyof LandingPage,
6 direction: Direction,
7 onSortChange: (orderBy: OrderBy, direction: Direction) => void,
8 setShowCaret: React.Dispatch<React.SetStateAction<boolean>>
9 ) => {
10 let orderBy: OrderBy = 'name';
11 if (column === 'last_published') {
12 orderBy = 'date';
13 }
14 onSortChange(orderBy, direction);
15 setShowCaret(true);
16 };
17