Merge pull request #353 from sevonj/listview-selfpost-thumbnail

Listview selfpost thumbnail
This commit is contained in:
Xylight authored and GitHub committed 2024-07-11 15:32:00 -07:00
commit 678d9a2ddc
2 files changed
+26 -5

No files matched your search

@@ -141,7 +141,6 @@
</div> </div>
{#if view == 'list' || view == 'compact'} {#if view == 'list' || view == 'compact'}
<PostMediaCompact <PostMediaCompact
{view}
bind:post={post.post} bind:post={post.post}
bind:type bind:type
class="{$userSettings.leftAlign class="{$userSettings.leftAlign
@@ -12,7 +12,6 @@
import { Material, Popover } from 'mono-svelte' import { Material, Popover } from 'mono-svelte'
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 post: Post export let post: Post
export let type: MediaType = 'none' export let type: MediaType = 'none'
</script> </script>
@@ -21,7 +20,6 @@
@component @component
Thumbnails for compact and list view posts. Thumbnails for compact and list view posts.
--> -->
{#if view == 'compact' || (view == 'list' && type != 'none')}
<div <div
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}" class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
style={$$props.style ?? ''} style={$$props.style ?? ''}
@@ -45,6 +43,31 @@
</div> </div>
</Popover> </Popover>
{/if} {/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"
>
<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 <svelte:element
this={!$userSettings.expandImages || type != 'image' ? 'a' : 'button'} this={!$userSettings.expandImages || type != 'image' ? 'a' : 'button'}
href={postLink(post)} href={postLink(post)}
@@ -92,5 +115,4 @@
</div> </div>
{/if} {/if}
</svelte:element> </svelte:element>
</div> </div>
{/if}