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
+28 -24

No files matched your search

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