From 41449f049d543e111431ac6b577c54c39b525be8 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Mon, 8 Aug 2022 12:38:52 +0200 Subject: [PATCH] Sort projects --- pages/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/index.tsx b/pages/index.tsx index c4a9d66..08c10b3 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -7,6 +7,7 @@ import { useModalFunctions } from "../components/contexts/ModalFunctions"; import ProjectModal from "../components/ProjectModal"; import REPL from "../components/REPL"; import styles from "../styles/Home.module.css"; +import type { ContentList } from "../lib/content/types"; const Home: NextPage<{ buildTime: string }> = ({ buildTime }) => { const inputRef = useRef(null); @@ -16,7 +17,10 @@ const Home: NextPage<{ buildTime: string }> = ({ buildTime }) => { const updateProjects = useCallback(async () => { try { const res = await fetch("/content/list.json"); - const projects = await res.json(); + const projects: ContentList = await res.json(); + projects.sort((a, b) => { + return a.name.localeCompare(b.name); + }); setContents(projects); } catch {} }, [setContents]);