Resources page, ResourceBlock, schemas

This commit is contained in:
Antoine Phan
2025-07-25 16:28:23 -04:00
parent c67d68595f
commit 7e2b9d32aa
5 changed files with 30 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
let { children, onclick } = $props(); let { children, onclick = null } = $props();
</script> </script>
<button <button

View File

@@ -1,17 +1,18 @@
<script> <script>
import { slide } from 'svelte/transition';
import Button from './Button.svelte'; import Button from './Button.svelte';
import Link from './Link.svelte'; import Link from './Link.svelte';
let { title = '_Resource Title_', children = () => {}, link = "https://example.com"} = $props(); let { title = '_Resource Title_', children, link = 'https://example.com' } = $props();
</script> </script>
<div class="bg-ecsess-200 w-96 rounded-lg px-8 py-4"> <div class="bg-ecsess-200 ring-6 ring-ecsess-600 hover:ring-ecsess-200/60 hover:shadow-3xl max-w-sm rounded-lg w-full transition-all" transition:slide>
<p class="text-ecsess-black text-xl font-semibold pb-2"> <Link href={link}>
<div class="px-8 py-4">
<p class="text-ecsess-800 px-2 text-xl font-semibold lg:text-2xl">
{title} {title}
</p> </p>
<p class="text-ecsess-black text-base font-normal py-2">{@render children()}</p> <p class="text-ecsess-black pt-3 text-base font-normal lg:text-lg">{@render children()}</p>
</div>
<Link href={link}>
<Button>Access</Button>
</Link> </Link>
</div> </div>

View File

@@ -46,4 +46,10 @@ export type CouncilMember = {
yearProgram: string; yearProgram: string;
}; };
export type Resource = {
title: string;
url: string;
description: string;
}
export type Redirect = { shortname: string; url: string }; export type Redirect = { shortname: string; url: string };

View File

@@ -1,3 +1,4 @@
import type { Resource } from '$lib/schemas';
import { getFromCMS } from '$lib/utils.js'; import { getFromCMS } from '$lib/utils.js';
// needs to concat and format this text // needs to concat and format this text
@@ -5,11 +6,11 @@ const query = `*[_type == "resources"]{
title, title,
url, url,
description, description,
"lastUpdated":_updatedAt
}`; }`;
export const load = async () => { export const load = async () => {
const resources: Resource[] = await getFromCMS(query);
return { return {
resources: await getFromCMS(query) resources: resources
}; };
}; };

View File

@@ -1,4 +1,5 @@
<script> <script>
import ResourceCard from 'components/ResourceCard.svelte';
import Section from 'components/Section.svelte'; import Section from 'components/Section.svelte';
let { data } = $props(); let { data } = $props();
</script> </script>
@@ -8,12 +9,11 @@
<Section> <Section>
<p class="page-title">Resources</p> <p class="page-title">Resources</p>
<h1>Resources for ECSE students at McGill University, presented by ECSESS!</h1> <div class="flex flex-col gap-8">
{#each data.resources as re} {#each data.resources as re}
{re.title} <br> <ResourceCard title={re.title} link={re.url}>
{re.url} <br> {re.description}
{re.description} <br> </ResourceCard>
<p>==============</p>
{/each} {/each}
</div>
</Section> </Section>