-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort stations in combo box alphabetically (#139)
* feat(global): add toSortedStationsAlphabetically fn; * chore(global): remove unnecessary parentheses; * fixed the root station to always appear on top --------- Co-authored-by: Amar Cerim <[email protected]>
- Loading branch information
Showing
3 changed files
with
30 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
import Station from '@/models/station.model'; | ||
import { clsx, type ClassValue } from 'clsx'; | ||
import { twMerge } from 'tailwind-merge'; | ||
|
||
export function cn(...inputs: ClassValue[]) { | ||
return twMerge(clsx(inputs)); | ||
} | ||
|
||
export function toSortedStationsAlphabetically(stations:Station[]):Station[] { | ||
const rootStationName = 'Zenica "AS"' | ||
|
||
return stations.sort((a, b) => { | ||
if (a.name === rootStationName || b.name === rootStationName) return 1; | ||
return a.name.localeCompare(b.name); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.