design: use commonlist for sidebar items
This commit is contained in:
8 files changed
+174
-192
No files matched your search
@@ -22,6 +22,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import SearchBar from '../search/SearchBar.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -51,34 +52,8 @@
|
||||
</Header>
|
||||
|
||||
<form method="get" action="/communities" class="contents" bind:this={form}>
|
||||
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22">
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
||||
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 rounded-full! h-full"
|
||||
placeholder={$t('routes.communities.search.placeholder')}
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to != null}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Tabs>
|
||||
</div>
|
||||
<SearchBar bind:query={search} />
|
||||
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Location
|
||||
name="type"
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
<article class="flex flex-col gap-2 animate-pop-in">
|
||||
<header class="flex flex-col gap-2">
|
||||
<div class="flex flex-row justify-between items-center gap-2 flex-wrap">
|
||||
<div class="flex flex-row items-center gap-2 flex-wrap">
|
||||
<PostMeta
|
||||
community={data.post.value.post_view.community}
|
||||
user={data.post.value.post_view.creator}
|
||||
@@ -156,11 +156,6 @@
|
||||
style="width: max-content;"
|
||||
tags={parseTags(data.post.value.post_view.post.name).tags}
|
||||
/>
|
||||
<Button onclick={() => history.back()} size="square-md">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeft} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
<h1 class="font-medium text-xl leading-5">
|
||||
<Markdown
|
||||
@@ -221,6 +216,7 @@
|
||||
{/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
|
||||
@@ -252,7 +248,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/await}
|
||||
<section class="mt-4 flex flex-col gap-2 w-full" id="comments">
|
||||
<section class="flex flex-col gap-2 w-full" id="comments">
|
||||
<header>
|
||||
<div class="text-base">
|
||||
<span class="font-bold">
|
||||
|
||||
@@ -14,30 +14,28 @@
|
||||
let searchElement = $state<HTMLInputElement>()
|
||||
</script>
|
||||
|
||||
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22">
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
||||
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 rounded-full! h-full text-base!"
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to?.route.id == '/search'}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Tabs>
|
||||
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22 drop-shadow-xl">
|
||||
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 rounded-full! h-full text-base!"
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to?.route.id == '/search'}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,6 +70,7 @@
|
||||
import Section from './Section.svelte'
|
||||
import Setting from './Setting.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
|
||||
@@ -182,50 +183,10 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div class="flex items-center gap-2 flex-wrap w-full my-5">
|
||||
<Button href="#app" size="sm" class="text-xs" rounding="pill">
|
||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||
{$t('settings.app.title')}
|
||||
</Button>
|
||||
<Button href="#embeds" size="sm" class="text-xs" rounding="pill">
|
||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||
{$t('settings.embeds.title')}
|
||||
</Button>
|
||||
<Button href="#lemmy" size="sm" class="text-xs" rounding="pill">
|
||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||
{$t('settings.lemmy.title')}
|
||||
</Button>
|
||||
<Button href="#moderation" size="sm" class="text-xs" rounding="pill">
|
||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||
{$t('settings.moderation.title')}
|
||||
</Button>
|
||||
<Button href="#other" size="sm" class="text-xs" rounding="pill">
|
||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||
{$t('settings.other.title')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex flex-col *:py-2 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
style="scroll-behavior: smooth;"
|
||||
>
|
||||
{#if profile.current?.jwt}
|
||||
<Section open={false} id="account" title={$t('settings.account.title')}>
|
||||
<div>
|
||||
<Button
|
||||
color="primary"
|
||||
size="lg"
|
||||
href="/profile/settings"
|
||||
class="block"
|
||||
>
|
||||
{$t('profile.profile')}
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Section>
|
||||
{/if}
|
||||
<Section id="app" title={$t('settings.app.title')}>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE}
|
||||
<Setting icon={Heart}>
|
||||
@@ -606,7 +567,7 @@
|
||||
</Section>
|
||||
|
||||
<Section id="moderation" title={$t('settings.moderation.title')}>
|
||||
<Setting icon={Trash}>
|
||||
<Setting icon={Trash} adaptive={false}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
@@ -630,76 +591,70 @@
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<Material
|
||||
color="transparent"
|
||||
rounding="xl"
|
||||
padding="sm"
|
||||
class="py-3 w-full rounded-full"
|
||||
>
|
||||
<details>
|
||||
<summary
|
||||
class="cursor-pointer inline-flex flex-row items-center w-full gap-1"
|
||||
>
|
||||
<Icon src={ChevronDown} mini size="16" />
|
||||
{preset.title}
|
||||
<Button
|
||||
size="square-md"
|
||||
rounding="lg"
|
||||
class="ml-auto"
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
</Button>
|
||||
</summary>
|
||||
<div class="flex flex-col gap-3 mt-2">
|
||||
<TextInput
|
||||
label="Title"
|
||||
bind:value={preset.title}
|
||||
placeholder="Reason 1"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
bind:value={preset.content}
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
reason: '<Being a meanie>',
|
||||
username: '@Bob',
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
</details>
|
||||
</Material>
|
||||
{/each}
|
||||
<Material color="transparent" rounding="xl" padding="none" class="w-full">
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full"
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
]
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</Material>
|
||||
</Setting>
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<li>
|
||||
<Expandable>
|
||||
{#snippet title()}
|
||||
{preset.title}
|
||||
{/snippet}
|
||||
<div class="flex flex-col gap-3">
|
||||
<TextInput
|
||||
label="Title"
|
||||
bind:value={preset.title}
|
||||
placeholder="Reason 1"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
bind:value={preset.content}
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
reason: '<Being a meanie>',
|
||||
username: '@Bob',
|
||||
})}
|
||||
/>
|
||||
|
||||
<Button
|
||||
color="danger"
|
||||
rounding="pill"
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
class="w-max"
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{$t('common.remove')}
|
||||
</Button>
|
||||
</div>
|
||||
</Expandable>
|
||||
</li>
|
||||
{/each}
|
||||
<li>
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full p-2"
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
]
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</li>
|
||||
</Section>
|
||||
|
||||
<Section id="other" title={$t('settings.other.title')}>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
description?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
icon?: IconSource
|
||||
adaptive?: boolean
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -37,6 +38,7 @@
|
||||
description,
|
||||
children,
|
||||
icon,
|
||||
adaptive = true,
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
@@ -74,7 +76,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class={['setting-grid items-center', clazz]}>
|
||||
<div class={['setting-grid items-center', adaptive && 'adaptive', clazz]}>
|
||||
{#if icon}
|
||||
<Icon
|
||||
src={icon}
|
||||
@@ -124,7 +126,7 @@
|
||||
}
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
.setting-grid {
|
||||
.setting-grid.adaptive {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
grid-template-rows: auto auto;
|
||||
|
||||
Reference in new issue
Block a user