<script lang="ts">
    import type { Snippet } from "svelte";

    interface Props {
        alt: string;
        imgSrc: string;
        description?: Snippet;
        href?: string;
    }

    const { alt, imgSrc, description, href }: Props = $props();
</script>

<a class="card" {href}>
    <img src={imgSrc} {alt} />
    <div class="description">
        {@render description?.()}
    </div>
</a>

<style>
    .card {
        display: flex;
        flex-direction: column;
        background-color: #38353f;
    }
    .description {
        padding: 0.5rem;
        color: #edebe9;
        font-size: 0.875rem;
    }
    img {
        width: 16rem;
        aspect-ratio: 1 / 1;
    }
</style>
