fix: post thumbnail alignment, close #265

This commit is contained in:
Xylight committed 2024-03-16 16:09:07 -07:00
1 parent 4b639c06d2
commit a724313eca
3 files changed
+30 -26

No files matched your search

+17 -22
View File
@@ -34,11 +34,11 @@
<Material
color={view != 'card' ? 'none' : 'distinct'}
padding="none"
class="relative max-w-full min-w-0 w-full group gap-2 flex flex-col
class="relative max-w-full min-w-0 w-full group gap-2 flex flex-col
{view != 'card' ? 'bg-transparent !border-0' : 'p-5'} {view == 'compact'
? 'py-4'
? 'py-4 list-type'
: view == 'list'
? 'py-5'
? 'py-5 list-type'
: 'py-5'} {$$props.class}"
id={post.post.id}
>
@@ -63,23 +63,18 @@
: 'NotSubscribed'}
id={post.post.id}
title={post.post.name}
style="grid-area: meta;"
>
<slot name="badges" slot="badges" />
</PostMeta>
<PostMedia bind:post={post.post} {view} {type} />
<div style="grid-area:embed">
<PostMedia bind:post={post.post} {view} {type} />
</div>
{#if view == 'list' || view == 'compact'}
<PostMediaCompact
{view}
bind:post={post.post}
style="grid-area: media; grid-column: span 2 / span 2;"
/>
<PostMediaCompact {view} bind:post={post.post} style="grid-area: media;" />
{/if}
{#if post.post.body && !post.post.nsfw && view != 'compact'}
<PostBody
body={post.post.body}
{view}
style="grid-area: body; grid-column: span 1 / span 1;"
/>
<PostBody body={post.post.body} {view} style="grid-area: body" />
{/if}
{#if actions}
<PostActions
@@ -90,7 +85,7 @@
type: 'success',
})
}}
style="grid-area: actions; grid-column: span 2 / span 2;"
style="grid-area: actions;"
/>
{/if}
</Material>
@@ -98,14 +93,14 @@
<style>
:global(.list-type) {
display: grid;
gap: 0;
grid-template-areas:
'meta' 'media'
'body' 'media'
'actions' 'actions';
gap: 0.5rem;
grid-template-areas: var(
--template-areas,
'meta media' 'title media' 'body media' 'embed embed' 'actions actions'
);
width: 100%;
height: 100%;
grid-template-rows: 3;
grid-template-columns: 2;
grid-template-rows: auto auto auto auto auto;
grid-template-columns: var(--template-columns, 1fr auto);
}
</style>
@@ -75,6 +75,14 @@
class="flex flex-col list-none {$userSettings.view == 'card'
? 'gap-3 md:gap-4'
: 'divide-y'} divide-slate-200 dark:divide-zinc-800"
style={$userSettings.leftAlign
? `--template-areas:
'media meta'
'media title'
'media body'
'embed embed'
'actions actions'; --template-columns: auto 1fr;`
: ``}
>
{#if posts?.length == 0}
<div class="h-full grid place-items-center">
@@ -53,7 +53,7 @@
subscribed =
subscribed == 'NotSubscribed' ? 'Subscribed' : 'NotSubscribed'
}}
class="relative cursor-pointer row-span-2 pr-2"
class="relative cursor-pointer pr-2 row-span-2"
>
<Avatar
url={community.icon}
@@ -83,7 +83,7 @@
<CommunityLink {community} style="grid-area: community;" />
{/if}
<span
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 flex-wrap items-center row-span-1"
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 flex-wrap items-center"
style="grid-area: stats;"
>
{#if user}
@@ -146,7 +146,7 @@
{#if title && id}
<a
href="/post/{getInstance()}/{id}"
class="font-medium row-span-1 text-base"
class="font-medium text-base"
style="grid-area: title;"
>
{title}
@@ -160,6 +160,7 @@
'avatar community badges'
'avatar stats badges';
gap: 0;
grid-template-columns: max-content;
grid-template-rows: auto auto;
grid-template-columns: auto 1fr;
}
</style>