fix: broken thumbnails
This commit is contained in:
1 parent
7acb71f80c
commit
0f487182b3
1 file changed
+13
-5
@@ -9,14 +9,14 @@
|
|||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import { isImage } from '$lib/ui/image'
|
import { isImage } from '$lib/ui/image'
|
||||||
import type { Post } from 'lemmy-js-client'
|
import type { Post } from 'lemmy-js-client'
|
||||||
import { DocumentText, Icon, Link, VideoCamera } from 'svelte-hero-icons';
|
import { DocumentText, Icon, Link, VideoCamera } from 'svelte-hero-icons'
|
||||||
|
|
||||||
export let view: 'card' | 'cozy' | 'list' | 'compact' = 'cozy'
|
export let view: 'card' | 'cozy' | 'list' | 'compact' = 'cozy'
|
||||||
export let post: Post
|
export let post: Post
|
||||||
export let type: MediaType = 'none'
|
export let type: MediaType = 'none'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if view == "compact" || (view == "list" && !post.embed_title && (post.thumbnail_url || isImage(post.url)))}
|
{#if view == 'compact' || (view == 'list' && (!post.embed_title || type == 'iframe') && type != 'none')}
|
||||||
<div
|
<div
|
||||||
class="w-24 sm:w-32 h-24 group/media {$$props.class ?? ''}"
|
class="w-24 sm:w-32 h-24 group/media {$$props.class ?? ''}"
|
||||||
style={$$props.style ?? ''}
|
style={$$props.style ?? ''}
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
this={!$userSettings.expandImages || type != 'image' ? 'a' : 'button'}
|
this={!$userSettings.expandImages || type != 'image' ? 'a' : 'button'}
|
||||||
href={postLink(post)}
|
href={postLink(post)}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (type == "image") {
|
if (type == 'image') {
|
||||||
showImage(bestImageURL(post, false, 2048));
|
showImage(bestImageURL(post, false, 2048))
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
role="button"
|
role="button"
|
||||||
@@ -56,7 +56,15 @@
|
|||||||
group-hover/media:dark:border-zinc-600 transition-colors text-slate-400 dark:text-zinc-600 grid
|
group-hover/media:dark:border-zinc-600 transition-colors text-slate-400 dark:text-zinc-600 grid
|
||||||
place-items-center"
|
place-items-center"
|
||||||
>
|
>
|
||||||
<Icon src={type == 'embed' ? Link : type == 'iframe' ? VideoCamera : DocumentText} solid size="32"/>
|
<Icon
|
||||||
|
src={type == 'embed'
|
||||||
|
? Link
|
||||||
|
: type == 'iframe'
|
||||||
|
? VideoCamera
|
||||||
|
: DocumentText}
|
||||||
|
solid
|
||||||
|
size="32"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
|
|||||||
Reference in new issue
Block a user