From bed472ede4cab85919c3887aa43766f2bffd732e Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sun, 20 Aug 2023 18:39:55 +0100 Subject: Sorts Lallans by issue number descending --- src/components/LallansIssuesGallery.astro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/components/LallansIssuesGallery.astro') diff --git a/src/components/LallansIssuesGallery.astro b/src/components/LallansIssuesGallery.astro index f3db9b3..9ade033 100644 --- a/src/components/LallansIssuesGallery.astro +++ b/src/components/LallansIssuesGallery.astro @@ -1,9 +1,14 @@ --- import { getAllLallansIssues } from '$data/lallans'; import getLocaleFromPath from '$lib/getLocaleFromPath'; +import type LallansIssue from '$types/LallansIssue'; const locale = getLocaleFromPath(Astro.url.pathname); -const issues = await getAllLallansIssues(); +const issues = (await getAllLallansIssues()).sort(issueNumberDescending); + +function issueNumberDescending(issue1: LallansIssue, issue2: LallansIssue) { + return issue2.issueNumber - issue1.issueNumber; +} ---