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