feat: add sort to community search page

This commit is contained in:
Xyphyn committed 2023-09-03 18:12:10 -07:00
1 parent d3ba6d969c
commit e9168d055e
7 files changed
+79 -55

No files matched your search

+18 -8
View File
@@ -4,6 +4,7 @@
import { page } from '$app/stores'
import {
ChatBubbleOvalLeftEllipsis,
GlobeAmericas,
Icon,
PencilSquare,
QuestionMarkCircle,
@@ -17,7 +18,8 @@
import { addSubscription } from '$lib/lemmy/user.js'
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
import { profile } from '$lib/auth.js'
import { Button } from 'mono-svelte'
import { Button, Select } from 'mono-svelte'
import Sort from '$lib/components/lemmy/Sort.svelte'
export let data
@@ -39,13 +41,21 @@
page, and search with this syntax:
<code>!community@instance.com</code>
</p>
<div class="flex flex-col sm:flex-row gap-4 mt-4">
<MultiSelect
options={['Subscribed', 'Local', 'All']}
selected={$page.url.searchParams.get('type') ??
(LINKED_INSTANCE_URL ? 'Local' : 'All')}
on:select={(e) => searchParam($page.url, 'type', e.detail, 'page')}
/>
<div class="flex flex-row flex-wrap gap-4 mt-4">
<Select
class="w-48"
bind:value={data.type}
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
>
<span slot="label" class="flex items-center gap-1">
<Icon src={GlobeAmericas} mini size="15" />
Location
</span>
<option value="All">All</option>
<option value="Local">Local</option>
<option value="Subscribed">Subscribed</option>
</Select>
<Sort selected={data.sort} />
<div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center">
<TextInput
bind:value={search}