Сделал компонент <Img/> для блог-постов
This commit is contained in:
parent
86dff5272e
commit
13c341d4ff
4 changed files with 23 additions and 1 deletions
20
src/lib/components/Img.svelte
Normal file
20
src/lib/components/Img.svelte
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue