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:
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user