refactor: allowed for SpaceCard.svelte to take in study_spaces Table instead of Snippets

Co-Authored-By: Tadios Temesgen <tt2022@ic.ac.uk>
This commit is contained in:
Caspar Jojo Asaam
2025-06-05 11:43:04 +01:00
parent 1d1bd940bf
commit 6e72580a6a
2 changed files with 7 additions and 15 deletions

View File

@@ -1,22 +1,21 @@
<script lang="ts">
import type { Snippet } from "svelte";
import type { Table } from "@supabase/supabase-js";
interface Props {
space: Table<"study_spaces">;
alt: string;
imgSrc: string;
title?: Snippet;
description?: Snippet;
href?: string;
}
const { alt, imgSrc, title, description, href }: Props = $props();
const { space, alt, imgSrc, href }: Props = $props();
</script>
<a class="card" {href}>
<img src={imgSrc} {alt} />
<div class="description">
{@render title?.()}
{@render description?.()}
<h1>{space.location}</h1>
<p>{space.description}</p>
</div>
</a>

View File

@@ -26,15 +26,8 @@
alt="Photo of {studySpace.description}"
href="/space/{studySpace.id}"
imgSrc={imgUrl}
>
{#snippet title()}
<h1>{studySpace.location}</h1>
{/snippet}
{#snippet description()}
<p>{studySpace.description}</p>
{/snippet}
</SpaceCard>
space={studySpace}
/>
{/each}
</main>