image uses caption
This commit is contained in:
parent
acc5bbd363
commit
b338fced35
2 changed files with 18 additions and 1 deletions
16
src/lib/components/Image.svelte
Normal file
16
src/lib/components/Image.svelte
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue