Merge pull request #353 from sevonj/listview-selfpost-thumbnail
Listview selfpost thumbnail
This commit is contained in:
2 files changed
+58
-37
No files matched your search
@@ -141,7 +141,6 @@
|
||||
</div>
|
||||
{#if view == 'list' || view == 'compact'}
|
||||
<PostMediaCompact
|
||||
{view}
|
||||
bind:post={post.post}
|
||||
bind:type
|
||||
class="{$userSettings.leftAlign
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
import { DocumentText, Icon, Link, VideoCamera } from 'svelte-hero-icons'
|
||||
|
||||
export let view: 'card' | 'cozy' | 'list' | 'compact' = 'cozy'
|
||||
export let post: Post
|
||||
export let type: MediaType = 'none'
|
||||
</script>
|
||||
@@ -21,7 +20,6 @@
|
||||
@component
|
||||
Thumbnails for compact and list view posts.
|
||||
-->
|
||||
{#if view == 'compact' || (view == 'list' && type != 'none')}
|
||||
<div
|
||||
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
|
||||
style={$$props.style ?? ''}
|
||||
@@ -56,41 +54,65 @@
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
{#if post.thumbnail_url || isImage(post.url)}
|
||||
<img
|
||||
src={optimizeImageURL(post.thumbnail_url || post.url || '', 128)}
|
||||
loading="lazy"
|
||||
class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl h-24 w-24 sm:w-32
|
||||
border border-slate-200 dark:border-zinc-800 group-hover/media:border-slate-400
|
||||
group-hover/media:dark:border-zinc-600 transition-colors"
|
||||
alt={post.name}
|
||||
/>
|
||||
{#if type != 'image'}
|
||||
<div
|
||||
class="relative w-7 h-7 bottom-8 left-1 rounded-lg text-slate-800 dark:text-zinc-200
|
||||
backdrop-blur-sm bg-[#ffffff]/75 dark:bg-black/75 grid place-items-center"
|
||||
>
|
||||
<Icon src={type == 'iframe' ? VideoCamera : Link} mini size="16" />
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<Material
|
||||
slot="target"
|
||||
padding="none"
|
||||
rounding="full"
|
||||
elevation="high"
|
||||
class="w-max absolute bottom-0 left-0 py-0.5 px-1.5 m-1 font-bold"
|
||||
>
|
||||
ALT
|
||||
</Material>
|
||||
<div class="max-w-sm">
|
||||
{post.alt_text}
|
||||
</div>
|
||||
</Popover>
|
||||
{/if}
|
||||
<svelte:element
|
||||
this={!$userSettings.expandImages || type != 'image' ? 'a' : 'button'}
|
||||
href={postLink(post)}
|
||||
on:click={() => {
|
||||
if (type == 'image') {
|
||||
showImage(bestImageURL(post, false, 2048))
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
{#if post.thumbnail_url || isImage(post.url)}
|
||||
<img
|
||||
src={optimizeImageURL(post.thumbnail_url || post.url || '', 128)}
|
||||
loading="lazy"
|
||||
class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl h-24 w-24 sm:w-32
|
||||
border border-slate-200 dark:border-zinc-800 group-hover/media:border-slate-400
|
||||
group-hover/media:dark:border-zinc-600 transition-colors"
|
||||
alt={post.name}
|
||||
/>
|
||||
{#if type != 'image'}
|
||||
<div
|
||||
class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl h-24 w-24 sm:w-32
|
||||
border border-slate-200 dark:border-zinc-800 group-hover/media:border-slate-400
|
||||
group-hover/media:dark:border-zinc-600 transition-colors text-slate-400 dark:text-zinc-600 grid
|
||||
place-items-center"
|
||||
class="relative w-7 h-7 bottom-8 left-1 rounded-lg text-slate-800 dark:text-zinc-200
|
||||
backdrop-blur-sm bg-[#ffffff]/75 dark:bg-black/75 grid place-items-center"
|
||||
>
|
||||
<Icon
|
||||
src={type == 'embed'
|
||||
? Link
|
||||
: type == 'iframe'
|
||||
? VideoCamera
|
||||
: DocumentText}
|
||||
solid
|
||||
size="32"
|
||||
/>
|
||||
<Icon src={type == 'iframe' ? VideoCamera : Link} mini size="16" />
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:element>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div
|
||||
class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl h-24 w-24 sm:w-32
|
||||
border border-slate-200 dark:border-zinc-800 group-hover/media:border-slate-400
|
||||
group-hover/media:dark:border-zinc-600 transition-colors text-slate-400 dark:text-zinc-600 grid
|
||||
place-items-center"
|
||||
>
|
||||
<Icon
|
||||
src={type == 'embed'
|
||||
? Link
|
||||
: type == 'iframe'
|
||||
? VideoCamera
|
||||
: DocumentText}
|
||||
solid
|
||||
size="32"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:element>
|
||||
</div>
|
||||
Reference in new issue
Block a user