From 6fc3866931b3d27cb77bf9b8a6119cb4c72e67c7 Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sun, 20 Aug 2023 18:45:33 +0100 Subject: Sorts Scotsoun by ID descending --- src/components/ScotsounCdGallery.astro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/ScotsounCdGallery.astro b/src/components/ScotsounCdGallery.astro index 0a8cd92..8ae2b22 100644 --- a/src/components/ScotsounCdGallery.astro +++ b/src/components/ScotsounCdGallery.astro @@ -1,9 +1,14 @@ --- import { getAllScotsoun } from '$data/scotsoun'; import getLocaleFromPath from '$lib/getLocaleFromPath'; +import type Scotsoun from '$types/Scotsoun'; const locale = getLocaleFromPath(Astro.url.pathname); -const scotsoun = await getAllScotsoun(); +const scotsoun = (await getAllScotsoun()).sort(scotsounIdDescending); + +function scotsounIdDescending(scotsoun1: Scotsoun, scotsoun2: Scotsoun) { + return scotsoun2.scotsounId.localeCompare(scotsoun1.scotsounId); +} ---