This repository has been archived on 2025-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
Files
terminally-online/src/utilities/icon.ts
2023-07-23 20:20:11 +03:00

63 lines
1.2 KiB
TypeScript

import { MEME_SORT, SORT_DIRECTION, TAG_SORT, VIEW } from '../types';
const getSortIcon = (
sort: MEME_SORT | TAG_SORT,
sortDirection: SORT_DIRECTION,
) => {
let sortIcon = '';
switch (sort) {
case MEME_SORT.TITLE:
case TAG_SORT.NAME:
case TAG_SORT.COLOR: {
sortIcon = 'sort-alphabetical';
break;
}
case MEME_SORT.DATE_CREATED:
case MEME_SORT.DATE_MODIFIED:
case MEME_SORT.DATE_USED:
case TAG_SORT.DATE_CREATED:
case TAG_SORT.DATE_MODIFIED:
case TAG_SORT.DATE_USED: {
sortIcon = 'sort-calendar';
break;
}
case MEME_SORT.TIMES_USED:
case MEME_SORT.SIZE:
case TAG_SORT.MEMES_LENGTH:
case TAG_SORT.TIMES_USED: {
sortIcon = 'sort-numeric';
break;
}
}
switch (sortDirection) {
case SORT_DIRECTION.ASCENDING: {
sortIcon += '-ascending';
break;
}
case SORT_DIRECTION.DESCENDING: {
sortIcon += '-descending';
break;
}
}
return sortIcon;
};
const getViewIcon = (view: VIEW) => {
switch (view) {
case VIEW.MASONRY: {
return 'view-dashboard';
}
case VIEW.GRID: {
return 'view-grid';
}
case VIEW.LIST: {
return 'view-list';
}
}
};
export { getSortIcon, getViewIcon };