feat: use native select menu for sorts

This commit is contained in:
Xyphyn committed 2023-09-03 17:59:01 -07:00
1 parent 7358486ee0
commit d3ba6d969c
5 files changed
+67 -38

No files matched your search

+6 -6
View File
@@ -51,13 +51,13 @@
</span>
</div>
</div>
<div class="xl:hidden">
<Button color="secondary" on:click={() => (sidebar = !sidebar)}>
About
</Button>
</div>
<div class="flex flex-col sm:flex-row gap-4 max-w-full w-full">
<div class="flex flex-row gap-4 max-w-full w-full items-end">
<Sort selected={data.sort} />
<div class="xl:hidden">
<Button color="secondary" on:click={() => (sidebar = !sidebar)}>
About
</Button>
</div>
</div>
<PostFeed posts={data.posts.posts} />
<Pageination
+26 -13
View File
@@ -6,10 +6,15 @@
import { toast } from '$lib/components/ui/toasts/toasts.js'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import Link from '$lib/components/input/Link.svelte'
import { ArrowPath, Icon } from 'svelte-hero-icons'
import {
ArrowPath,
ChatBubbleOvalLeftEllipsis,
GlobeAmericas,
Icon,
} from 'svelte-hero-icons'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
import { Button, Checkbox } from 'mono-svelte'
import { Button, Checkbox, Select } from 'mono-svelte'
let data = {
loading: false,
@@ -42,22 +47,30 @@
<span slot="description">The default sort to use for feeds.</span>
<div class="flex flex-wrap flex-row gap-4 w-full">
<div class="max-w-full">
<span class="block my-1 font-bold">Feed</span>
<MultiSelect
options={['Subscribed', 'Local', 'All']}
bind:selected={$userSettings.defaultSort.feed}
/>
<Select bind:value={$userSettings.defaultSort.feed} class="w-28">
<span slot="label" class="flex items-center gap-1">
<Icon src={GlobeAmericas} size="16" mini />
Location
</span>
<option value="All">All</option>
<option value="Local">Local</option>
<option value="Subscribed">Subscribed</option>
</Select>
</div>
<div class="max-w-full">
<span class="block my-1 font-bold">Sort</span>
<Sort bind:selected={$userSettings.defaultSort.sort} navigate={false} />
</div>
<div class="max-w-full">
<span class="block my-1 font-bold">Comments</span>
<MultiSelect
options={['Hot', 'Top', 'New']}
bind:selected={$userSettings.defaultSort.comments}
/>
<Select bind:value={$userSettings.defaultSort.comments}>
<span slot="label" class="flex items-center gap-1">
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
Comments
</span>
<option value="Hot">Hot</option>
<option value="Top">Top</option>
<option value="New">New</option>
</Select>
</div>
</div>
</Setting>
+30 -14
View File
@@ -6,7 +6,9 @@
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import {
Bars3BottomRight,
Calendar,
ChartBar,
ChatBubbleOvalLeftEllipsis,
Envelope,
Icon,
@@ -33,7 +35,7 @@
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
import { searchParam } from '$lib/util.js'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { Button, Modal } from 'mono-svelte'
import { Button, Modal, Select } from 'mono-svelte'
export let data
@@ -141,19 +143,33 @@
<div class="flex flex-col-reverse xl:flex-row gap-4 max-w-full w-full">
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
<div class="flex flex-row gap-4 flex-wrap">
<MultiSelect
options={['New', 'TopAll', 'Old']}
optionNames={['New', 'Top', 'Old']}
selected={data.sort}
on:select={(e) => searchParam($page.url, 'sort', e.detail, 'page')}
/>
<MultiSelect
options={['all', 'posts', 'comments']}
optionNames={['All', 'Posts', 'Comments']}
selected={data.type}
on:select={(e) => searchParam($page.url, 'type', e.detail, 'page')}
/>
<div class="flex flex-row gap-4 flex-wrap justify-between">
<Select
bind:value={data.sort}
on:change={() => searchParam($page.url, 'sort', data.sort, 'page')}
class="w-48"
>
<span slot="label" class="flex items-center gap-1">
<Icon src={ChartBar} size="14" mini />
Sort
</span>
<option value="New">New</option>
<option value="TopAll">Top</option>
<option value="Old">Old</option>
</Select>
<Select
bind:value={data.type}
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
class="w-48"
>
<span slot="label" class="flex items-center gap-1">
<Icon src={Bars3BottomRight} size="15" mini />
Type
</span>
<option value="all">All</option>
<option value="posts">Posts</option>
<option value="comments">Comments</option>
</Select>
</div>
{#if data.items.length == 0}
<Placeholder