Files
standardnotes-app-web/app/assets/javascripts/Utils/SortThemes.ts
2022-04-13 22:02:34 +05:30

15 lines
424 B
TypeScript

import { ThemeItem } from '@/Components/QuickSettingsMenu/ThemeItem'
export const sortThemes = (a: ThemeItem, b: ThemeItem) => {
const aIsLayerable = a.component?.isLayerable()
const bIsLayerable = b.component?.isLayerable()
if (aIsLayerable && !bIsLayerable) {
return 1
} else if (!aIsLayerable && bIsLayerable) {
return -1
} else {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1
}
}