1
0
Fork 0

Add class to PostMedia

This commit is contained in:
Leon Grünewald 2024-10-24 01:07:05 +02:00
parent 6abd8874f2
commit 8c5d490061

View file

@ -8,17 +8,17 @@
*/
/** @type {Props} */
let { post = null } = $props();
let { post = null, class: className} = $props();
</script>
{#if post?.preview?.has}
<img class:max-h-dvh={settings.limitImageHeight} src={post.preview.url} alt={`Post ${post.id}`} />
<img class:max-h-dvh={settings.limitImageHeight} class={className} src={post.preview.url} alt={`Post ${post.id}`} />
{:else}
{#if ['webm', 'mp4'].includes(post.file.ext)}
<video class:max-h-dvh={settings.limitImageHeight} controls playsinline>
<video class:max-h-dvh={settings.limitImageHeight} class={className} controls playsinline>
<source src={post.file.url} />
</video>
{:else}
<img class:max-h-dvh={settings.limitImageHeight} src={post.file.url} alt={`Post ${post.id}`} />
<img class:max-h-dvh={settings.limitImageHeight} class={className} src={post.file.url} alt={`Post ${post.id}`} />
{/if}
{/if}