image uses caption

This commit is contained in:
Benjamin Palko 2025-06-27 09:07:19 -04:00
parent acc5bbd363
commit b338fced35
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,16 @@
<script lang="ts">
interface Props {
src: string;
alt: string;
caption?: string;
}
let { src, alt, caption }: Props = $props();
</script>
<figure class="flex flex-col">
<img class="aspect-4/2 w-full object-cover" {src} {alt} />
{#if caption}
<figcaption class="mt-2 text-center text-sm text-gray-500 italic">{caption}</figcaption>
{/if}
</figure>