misc: make search buttons look much better
This commit is contained in:
1 parent
abd50ab16c
commit
87aeee8e8f
2 files changed
+49
-14
No files matched your search
@@ -8,6 +8,7 @@
|
|||||||
GlobeAmericas,
|
GlobeAmericas,
|
||||||
Icon,
|
Icon,
|
||||||
InformationCircle,
|
InformationCircle,
|
||||||
|
MagnifyingGlass,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
Plus,
|
Plus,
|
||||||
QuestionMarkCircle,
|
QuestionMarkCircle,
|
||||||
@@ -87,8 +88,21 @@
|
|||||||
on:submit|preventDefault={() => searchParam($page.url, 'q', search, 'page')}
|
on:submit|preventDefault={() => searchParam($page.url, 'q', search, 'page')}
|
||||||
class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center"
|
class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center"
|
||||||
>
|
>
|
||||||
<TextInput bind:value={search} />
|
<TextInput
|
||||||
<Button submit color="ghost" class="h-max">Search</Button>
|
bind:value={search}
|
||||||
|
placeholder="Search for a community..."
|
||||||
|
label="Query"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
submit
|
||||||
|
color="ghost"
|
||||||
|
size="square-md"
|
||||||
|
class="self-end"
|
||||||
|
aria-label="Search"
|
||||||
|
>
|
||||||
|
<Icon src={MagnifyingGlass} size="16" mini />
|
||||||
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ul class="flex flex-col divide-y dark:divide-zinc-800">
|
<ul class="flex flex-col divide-y dark:divide-zinc-800">
|
||||||
|
|||||||
@@ -22,10 +22,11 @@
|
|||||||
PersonView,
|
PersonView,
|
||||||
PostView,
|
PostView,
|
||||||
} from 'lemmy-js-client'
|
} from 'lemmy-js-client'
|
||||||
import { Button, Select, Spinner, TextInput } from 'mono-svelte'
|
import { Button, Disclosure, Select, Spinner, TextInput } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
AdjustmentsHorizontal,
|
AdjustmentsHorizontal,
|
||||||
Bars3BottomRight,
|
Bars3BottomRight,
|
||||||
|
ChevronDown,
|
||||||
Icon,
|
Icon,
|
||||||
MagnifyingGlass,
|
MagnifyingGlass,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
@@ -39,6 +40,8 @@
|
|||||||
let query = data.query || ''
|
let query = data.query || ''
|
||||||
|
|
||||||
let pageNum = data.page
|
let pageNum = data.page
|
||||||
|
|
||||||
|
let moreOptions = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -46,7 +49,7 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<h1 class="font-bold text-3xl">Search</h1>
|
<h1 class="font-bold text-3xl">Search</h1>
|
||||||
<div class="flex flex-row flex-wrap sm:justify-between items-center gap-4 mt-4">
|
<div class="flex flex-row flex-wrap items-center gap-4 mt-4">
|
||||||
<Select
|
<Select
|
||||||
bind:value={data.type}
|
bind:value={data.type}
|
||||||
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
|
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
|
||||||
@@ -61,22 +64,38 @@
|
|||||||
<option value="Communities">Communities</option>
|
<option value="Communities">Communities</option>
|
||||||
<option value="Users">Users</option>
|
<option value="Users">Users</option>
|
||||||
</Select>
|
</Select>
|
||||||
<div class="flex flex-row gap-2 items-center">
|
<form
|
||||||
|
class="flex flex-row gap-2 items-center ml-auto"
|
||||||
|
on:submit|preventDefault={() => searchParam($page.url, 'q', query, 'page')}
|
||||||
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
label="Query"
|
||||||
bind:value={query}
|
bind:value={query}
|
||||||
placeholder="!community@instance.com"
|
placeholder="!community@instance.com"
|
||||||
on:change={() => searchParam($page.url, 'q', query, 'page')}
|
inlineAffixes
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
on:click={() => searchParam($page.url, 'q', query, 'page')}
|
|
||||||
size="lg"
|
|
||||||
class="h-full"
|
|
||||||
>
|
>
|
||||||
Search
|
<button
|
||||||
|
type="submit"
|
||||||
|
aria-label="Search"
|
||||||
|
slot="suffix"
|
||||||
|
class="flex items-center"
|
||||||
|
>
|
||||||
|
<Icon src={MagnifyingGlass} size="20" mini />
|
||||||
|
</button>
|
||||||
|
</TextInput>
|
||||||
|
</form>
|
||||||
|
<Button
|
||||||
|
slot="summary"
|
||||||
|
size="square-lg"
|
||||||
|
color="tertiary"
|
||||||
|
class="self-end justify-self-center"
|
||||||
|
on:click={() => (moreOptions = !moreOptions)}
|
||||||
|
>
|
||||||
|
<Icon src={ChevronDown} size="20" mini />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{#if moreOptions}
|
||||||
<div class="max-w-sm my-2">
|
<div transition:slide={{ axis: 'y', easing: expoOut }} class="max-w-sm">
|
||||||
<ObjectAutocomplete
|
<ObjectAutocomplete
|
||||||
label="Community"
|
label="Community"
|
||||||
jwt={$profile?.jwt}
|
jwt={$profile?.jwt}
|
||||||
@@ -86,11 +105,13 @@
|
|||||||
searchParam($page.url, 'community', c.detail?.id || undefined, 'page')}
|
searchParam($page.url, 'community', c.detail?.id || undefined, 'page')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
{#if !data.results}
|
{#if !data.results}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={MagnifyingGlass}
|
icon={MagnifyingGlass}
|
||||||
title="No results"
|
title="No results"
|
||||||
description="Search across the fediverse"
|
description="Search across the fediverse"
|
||||||
|
class="pt-4"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
{#await data.streamed.object}
|
{#await data.streamed.object}
|
||||||
|
|||||||
Reference in new issue
Block a user