design: improve compact/list posts

This commit is contained in:
Xylight committed 2024-05-30 17:46:58 -07:00
1 parent 386f738e6a
commit 2edfdf8421
2 files changed
+33 -29

No files matched your search

+15 -9
View File
@@ -85,15 +85,21 @@
> >
<slot name="badges" slot="badges" /> <slot name="badges" slot="badges" />
</PostMeta> </PostMeta>
<div {#key post.post.url}
style="grid-area:embed" <div
class={view == 'list' || view == 'compact' ? '' : 'contents'} style="grid-area:embed;"
> class={view == 'list' || view == 'compact' ? '' : 'contents'}
<PostMedia bind:post={post.post} {view} {type} /> >
</div> <PostMedia bind:post={post.post} {view} {type} />
{#if view == 'list' || view == 'compact'} </div>
<PostMediaCompact {view} bind:post={post.post} style="grid-area: media;" /> {#if view == 'list' || view == 'compact'}
{/if} <PostMediaCompact
{view}
bind:post={post.post}
style="grid-area: media;"
/>
{/if}
{/key}
{#if post.post.body && !post.post.nsfw && view != 'compact' && !hideBody} {#if post.post.body && !post.post.nsfw && view != 'compact' && !hideBody}
<PostBody body={post.post.body} {view} style="grid-area: body" /> <PostBody body={post.post.body} {view} style="grid-area: body" />
{/if} {/if}
@@ -10,25 +10,23 @@
</script> </script>
{#if (view == 'list' || view == 'compact') && !post.embed_title && (post.thumbnail_url || isImage(post.url))} {#if (view == 'list' || view == 'compact') && !post.embed_title && (post.thumbnail_url || isImage(post.url))}
<div class="flex-shrink-0 w-24 h-24" style={$$props.style ?? ''}> <div class="w-32 h-24" style={$$props.style ?? ''}>
{#if !$userSettings.expandImages || (post.thumbnail_url && !isImage(post.url))} <svelte:element
<a href={postLink(post)}> this={!$userSettings.expandImages ||
<!-- svelte-ignore a11y-missing-attribute --> (post.thumbnail_url && !isImage(post.url))
<img ? 'a'
src={bestImageURL(post, true)} : 'button'}
loading="lazy" href={postLink(post)}
class="object-cover bg-slate-100 dark:bg-zinc-800 rounded-lg h-24 w-24 border border-slate-200 dark:border-zinc-700" on:click={() => showImage(bestImageURL(post, false, 2048))}
/> role="button"
</a> tabindex="0"
{:else} >
<button on:click={() => showImage(bestImageURL(post, false, 2048))}> <img
<!-- svelte-ignore a11y-missing-attribute --> src={bestImageURL(post, true)}
<img loading="lazy"
src={bestImageURL(post, true)} class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl h-24 w-32 border border-slate-200 dark:border-zinc-800"
loading="lazy" alt={post.name}
class="object-cover bg-slate-100 rounded-lg h-24 w-24 border border-slate-200 dark:border-zinc-700" />
/> </svelte:element>
</button>
{/if}
</div> </div>
{/if} {/if}