chore: use builtin proseimg over custom element

This commit is contained in:
eggy
2023-12-29 17:34:57 -05:00
parent 1df49b0b84
commit 3bc334f0f3
10 changed files with 39 additions and 64 deletions

View File

@@ -0,0 +1,18 @@
<script setup lang="ts">
const props = withDefaults(defineProps<{ src: string; alt?: string }>(), {
alt: "",
});
const src = props.src;
const imgSrc =
src.startsWith("http://") || src.startsWith("https://")
? src
: `/images/posts/${src}`;
</script>
<template>
<figure class="flex flex-col items-center">
<img :src="imgSrc" class="drop-shadow-lg" :alt="alt" />
<figcaption class="text-center" v-if="alt">{{ alt }}</figcaption>
</figure>
</template>