design: improve communities page
This commit is contained in:
1 parent
e8f5d743d8
commit
f54c444fe6
6 files changed
+224
-82
No files matched your search
@@ -16,6 +16,9 @@
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -55,35 +58,41 @@
|
||||
</p>
|
||||
</Material>
|
||||
</Popover>
|
||||
|
||||
<form
|
||||
on:submit|preventDefault={() => searchParam($page.url, 'q', search, 'page')}
|
||||
class="flex gap-2 flex-row items-center"
|
||||
slot="extended"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="md"
|
||||
class="flex-1"
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="secondary"
|
||||
size="custom"
|
||||
class="self-end"
|
||||
style="width: 38px; height: 38px;"
|
||||
title="Search"
|
||||
>
|
||||
<Icon src={MagnifyingGlass} size="16" mini />
|
||||
</Button>
|
||||
</form>
|
||||
</Header>
|
||||
<div
|
||||
class="mt-4 mb-0 sticky z-30"
|
||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
||||
>
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
searchParam($page.url, 'q', search, 'page')}
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 !rounded-full h-full !text-base"
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="secondary"
|
||||
size="custom"
|
||||
class="flex-shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
>
|
||||
<Icon src={MagnifyingGlass} size="16" mini />
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Location selected={data.type} />
|
||||
<Sort selected={data.sort} />
|
||||
</div>
|
||||
<ul class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800">
|
||||
<ul class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 my-6">
|
||||
{#if data.communities.length == 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
@@ -91,8 +100,43 @@
|
||||
description={$t('routes.search.noResults.description')}
|
||||
/>
|
||||
{/if}
|
||||
{#each data.communities as community}
|
||||
<CommunityItem {community} />
|
||||
|
||||
{#if (data.query ?? '' != '') && data.communities.length > 0}
|
||||
<SectionTitle class="!border-0 pb-2">
|
||||
{$t('routes.search.top')}
|
||||
</SectionTitle>
|
||||
<div
|
||||
class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 !border-0"
|
||||
>
|
||||
{#each data.communities.slice(0, 3) as community}
|
||||
<Material
|
||||
color="distinct"
|
||||
padding="none"
|
||||
rounding="xl"
|
||||
class="dark:border-t-zinc-800 h-full"
|
||||
>
|
||||
<CommunityItem
|
||||
{community}
|
||||
showCounts={false}
|
||||
class="w-full p-4 text-center"
|
||||
view="cozy"
|
||||
/>
|
||||
</Material>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if data.communities.slice(data.query ?? '' != '' ? 3 : 0).length > 0}
|
||||
<SectionTitle class="!border-0 pb-2">
|
||||
{$t('routes.search.other')}
|
||||
</SectionTitle>
|
||||
{/if}
|
||||
{#each data.communities.slice(data.query ?? '' != '' ? 3 : 0) as community}
|
||||
<div
|
||||
class="-mx-4 sm:-mx-6 px-6 hover:bg-slate-100 hover:dark:bg-zinc-800 transition-colors"
|
||||
>
|
||||
<CommunityItem {community} showCounts={false} class="py-3" />
|
||||
</div>
|
||||
{/each}
|
||||
</ul>
|
||||
{#if data.communities.length > 0}
|
||||
|
||||
Reference in new issue
Block a user