From 7e2b9d32aa136eb7c568dfaea3199fc61f08f2ac Mon Sep 17 00:00:00 2001 From: Antoine Phan Date: Fri, 25 Jul 2025 16:28:23 -0400 Subject: [PATCH] Resources page, ResourceBlock, schemas --- src/components/Button.svelte | 2 +- src/components/ResourceCard.svelte | 23 ++++++++++++----------- src/lib/schemas.ts | 6 ++++++ src/routes/resources/+page.server.ts | 5 +++-- src/routes/resources/+page.svelte | 16 ++++++++-------- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/components/Button.svelte b/src/components/Button.svelte index fb195ff..b5b4a7d 100644 --- a/src/components/Button.svelte +++ b/src/components/Button.svelte @@ -1,5 +1,5 @@ - +

{@render children()}

+ + diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index 15f858c..fddc07f 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -46,4 +46,10 @@ export type CouncilMember = { yearProgram: string; }; +export type Resource = { + title: string; + url: string; + description: string; +} + export type Redirect = { shortname: string; url: string }; diff --git a/src/routes/resources/+page.server.ts b/src/routes/resources/+page.server.ts index 3d1dfea..b627263 100644 --- a/src/routes/resources/+page.server.ts +++ b/src/routes/resources/+page.server.ts @@ -1,3 +1,4 @@ +import type { Resource } from '$lib/schemas'; import { getFromCMS } from '$lib/utils.js'; // needs to concat and format this text @@ -5,11 +6,11 @@ const query = `*[_type == "resources"]{ title, url, description, - "lastUpdated":_updatedAt }`; export const load = async () => { + const resources: Resource[] = await getFromCMS(query); return { - resources: await getFromCMS(query) + resources: resources }; }; diff --git a/src/routes/resources/+page.svelte b/src/routes/resources/+page.svelte index ac49ed6..0ba6188 100644 --- a/src/routes/resources/+page.svelte +++ b/src/routes/resources/+page.svelte @@ -1,4 +1,5 @@ @@ -8,12 +9,11 @@

Resources

-

Resources for ECSE students at McGill University, presented by ECSESS!

- - {#each data.resources as re} - {re.title}
- {re.url}
- {re.description}
-

==============

- {/each} +
+ {#each data.resources as re} + + {re.description} + + {/each} +