design: improve posts
This commit is contained in:
10 files changed
+67
-28
No files matched your search
@@ -85,7 +85,7 @@
|
||||
<!--svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||
<div
|
||||
class="aspect-square w-max m-1 grid place-items-center text-slate-600 dark:text-zinc-400"
|
||||
class="aspect-square w-max m-1 grid place-items-center"
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
{#if !post.post.local}
|
||||
@@ -98,7 +98,12 @@
|
||||
class="w-full h-full"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||
<Icon
|
||||
src={EllipsisHorizontal}
|
||||
size="16"
|
||||
micro
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
|
||||
@@ -1,20 +1,52 @@
|
||||
<script lang="ts">
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
const sizes = {
|
||||
sm: 'text-sm',
|
||||
md: 'text-base',
|
||||
lg: 'text-lg',
|
||||
}
|
||||
|
||||
const colors = {
|
||||
subtle: 'text-slate-600 dark:text-zinc-400',
|
||||
none: '',
|
||||
}
|
||||
|
||||
interface Props {
|
||||
class?: string
|
||||
class?: ClassValue
|
||||
size?: keyof typeof sizes
|
||||
color?: keyof typeof colors
|
||||
border?: boolean
|
||||
children?: import('svelte').Snippet
|
||||
action?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { class: clazz = '', children, action }: Props = $props()
|
||||
let {
|
||||
class: clazz = '',
|
||||
children,
|
||||
action,
|
||||
border = true,
|
||||
size = 'sm',
|
||||
color = 'subtle',
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="flex flex-row items-center
|
||||
text-sm text-slate-600 dark:text-zinc-400 gap-2 flex-wrap {clazz}"
|
||||
class={[
|
||||
'flex flex-row items-center gap-2 flex-wrap',
|
||||
sizes[size],
|
||||
colors[color],
|
||||
clazz,
|
||||
]}
|
||||
>
|
||||
<span class="font-medium text-left">
|
||||
{@render children?.()}
|
||||
</span>
|
||||
<div class="flex-1"></div>
|
||||
<hr
|
||||
class={[
|
||||
'flex-1 border-slate-200 dark:border-zinc-800',
|
||||
!border && 'opacity-0',
|
||||
]}
|
||||
/>
|
||||
{@render action?.()}
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder>
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('account.accounts')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
@@ -134,7 +134,7 @@
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder>
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('routes.profile.moderates')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
@@ -185,7 +185,7 @@
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder>
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('profile.subscribed')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
|
||||
@@ -281,8 +281,8 @@
|
||||
"createPost": "Create Post",
|
||||
"createCommunity": "Create Community",
|
||||
"post": {
|
||||
"crosspostCount": "crossposts",
|
||||
"commentCount": "comments",
|
||||
"crosspostCount": "Crossposts",
|
||||
"commentCount": "Comments",
|
||||
"addComment": "Add a comment",
|
||||
"scrollToTop": "Scroll to top",
|
||||
"instanceWarning": "This post was requested from a different server than your account's. Many actions won't work.",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
import Label from '../forms/Label.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
|
||||
const borderClass = `border border-slate-200 border-b-slate-300 dark:border-zinc-800`
|
||||
const borderClass = `border border-slate-200 border-b-slate-300 dark:border-t-zinc-800 dark:border-zinc-900`
|
||||
|
||||
let {
|
||||
label = undefined,
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
}: Props<T> = $props()
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1 {clazz} {baseClass}">
|
||||
<div class={['flex flex-col gap-1', clazz, baseClass]}>
|
||||
{#if customLabel || label}
|
||||
<Label for={id} text={label}>
|
||||
{@render customLabel?.()}
|
||||
@@ -144,7 +144,7 @@
|
||||
disabled={option.disabled}
|
||||
color="none"
|
||||
class={[
|
||||
'min-h-0! py-[5px]! hover:bg-slate-100 dark:hover:bg-zinc-800',
|
||||
'min-h-0! py-1 hover:bg-slate-100 dark:hover:bg-zinc-800',
|
||||
option.value == value &&
|
||||
'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium',
|
||||
option.disabled &&
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
class="w-full max-w-sm origin-top-left max-h-128 overflow-auto list-none shadow-lg rounded-2xl"
|
||||
>
|
||||
<div
|
||||
class="flex flex-col px-0 list-none bg-white/80 dark:bg-zinc-900/90 gap-px rounded-2xl
|
||||
class="flex flex-col px-0 list-none bg-white/80 dark:bg-zinc-900/90 rounded-2xl
|
||||
border border-slate-300 dark:border-zinc-800 border-opacity-50"
|
||||
>
|
||||
{@render children?.(open)}
|
||||
|
||||
@@ -134,7 +134,11 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
<form class="accounts-grid mt-4 sm:mt-6 gap-4">
|
||||
<CommonList items={profile.meta.profiles}>
|
||||
<CommonList
|
||||
selected={p => p.id == profile.meta.profile}
|
||||
items={profile.meta.profiles}
|
||||
animate={false}
|
||||
>
|
||||
{#snippet item(p, index)}
|
||||
<label class="relative">
|
||||
<input
|
||||
@@ -149,9 +153,6 @@
|
||||
class={[
|
||||
'flex flex-row items-center gap-2 transition-all duration-75',
|
||||
'cursor-pointer relative ring-transparent',
|
||||
switching == p.id
|
||||
? 'ring-slate-500 dark:ring-zinc-500'
|
||||
: 'peer-checked:ring-primary-900 peer-checked:dark:ring-primary-100',
|
||||
]}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -216,7 +216,6 @@
|
||||
{/if}
|
||||
{/await}
|
||||
</article>
|
||||
<hr class="-mx-3 sm:-mx-6 my-6 border-slate-200 dark:border-zinc-800" />
|
||||
{#await data.comments.value then comments}
|
||||
{#if data.thread.value.showContext || data.thread.value.singleThread}
|
||||
<div
|
||||
@@ -249,13 +248,15 @@
|
||||
{/if}
|
||||
{/await}
|
||||
<section class="flex flex-col gap-2 w-full" id="comments">
|
||||
<header>
|
||||
<div class="text-base">
|
||||
<span class="font-bold">
|
||||
<FormattedNumber number={data.post.value.post_view.counts.comments} />
|
||||
</span>
|
||||
<header class="mt-4">
|
||||
<EndPlaceholder size="md" color="none">
|
||||
{$t('routes.post.commentCount')}
|
||||
</div>
|
||||
{#snippet action()}
|
||||
<span class="font-bold">
|
||||
<FormattedNumber number={data.post.value.post_view.counts.comments} />
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</header>
|
||||
{#if !page.url.searchParams.get('noVirtualize')}
|
||||
<noscript>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
{#if profile.current?.jwt}
|
||||
{#if !commenting}
|
||||
<EndPlaceholder>
|
||||
<EndPlaceholder border={false}>
|
||||
<Button
|
||||
color="primary"
|
||||
rounding="xl"
|
||||
|
||||
Reference in new issue
Block a user