Сделал компонент <Img/> для блог-постов

This commit is contained in:
Иван Кузьменко 2025-09-29 02:45:41 +03:00
parent 86dff5272e
commit 13c341d4ff
4 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,20 @@
<script lang="ts">
import { page } from '$app/state';
import { resolveBlogPath } from '$lib/util/Blogs';
export let src: string;
export let caption: string;
export let alt: string = '';
</script>
<div class="text-center">
<img
class="mx-auto mb-0 flex justify-center rounded-lg"
class:caption-img={caption}
src={resolveBlogPath(page.params.slug, src)}
alt={alt ? alt : src}
/>
{#if caption}
<p style="margin-top: 0px;">{caption}</p>
{/if}
</div>