impr: use native forms instead of submit events
This commit is contained in:
1 parent
3ebb46e37d
commit
4771d343e6
6 files changed
+27
-22
No files matched your search
@@ -186,7 +186,7 @@
|
|||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if actions}
|
{#if actions}
|
||||||
<PostActions on:hide {post} style="grid-area: actions;" {view} />
|
<PostActions on:hide bind:post style="grid-area: actions;" {view} />
|
||||||
{:else if view == 'compact'}
|
{:else if view == 'compact'}
|
||||||
<div class="flex flex-row items-center gap-2 text-sm">
|
<div class="flex flex-row items-center gap-2 text-sm">
|
||||||
<Badge>
|
<Badge>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
onclick={() => goto(pin.url)}
|
onclick={() => goto(pin.url)}
|
||||||
alignment="center"
|
alignment="center"
|
||||||
selected={`${$page.url.pathname}${$page.url.search}` == pin.url}
|
selected={`${$page.url.pathname}${$page.url.search}` == pin.url}
|
||||||
on:contextmenu={(e) => {
|
oncontextmenu={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
settings.dock.pins = settings.dock.pins.toSpliced(
|
settings.dock.pins = settings.dock.pins.toSpliced(
|
||||||
settings.dock.pins.findLastIndex((p) => pin.url == p.url),
|
settings.dock.pins.findLastIndex((p) => pin.url == p.url),
|
||||||
|
|||||||
@@ -40,8 +40,6 @@
|
|||||||
alignment="left"
|
alignment="left"
|
||||||
{...rest}
|
{...rest}
|
||||||
{href}
|
{href}
|
||||||
onclick
|
|
||||||
on:contextmenu
|
|
||||||
class="font-normal block !origin-left border border-transparent {!selected
|
class="font-normal block !origin-left border border-transparent {!selected
|
||||||
? 'text-slate-600 dark:text-zinc-400'
|
? 'text-slate-600 dark:text-zinc-400'
|
||||||
: ''} {clazz}"
|
: ''} {clazz}"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { backOut, expoOut } from 'svelte/easing'
|
import { backOut, expoOut } from 'svelte/easing'
|
||||||
|
import { goto } from '$app/navigation'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -61,14 +62,14 @@
|
|||||||
>
|
>
|
||||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
||||||
<form
|
<form
|
||||||
onsubmit={preventDefault(() =>
|
method="get"
|
||||||
searchParam($page.url, 'q', search, 'page'),
|
action="/communities"
|
||||||
)}
|
|
||||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
bind:value={search}
|
bind:value={search}
|
||||||
bind:element={searchElement}
|
bind:element={searchElement}
|
||||||
|
name="q"
|
||||||
aria-label={$t('routes.search.query')}
|
aria-label={$t('routes.search.query')}
|
||||||
size="lg"
|
size="lg"
|
||||||
class="flex-1 !rounded-full h-full"
|
class="flex-1 !rounded-full h-full"
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import { fly } from 'svelte/transition'
|
||||||
|
import { expoOut } from 'svelte/easing'
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -368,10 +370,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{#await data.comments}
|
{#await data.comments}
|
||||||
<div class="space-y-4">
|
<div class="flex flex-col gap-4">
|
||||||
{#each new Array(10) as empty}
|
{#each new Array(10) as empty, index}
|
||||||
<div class="animate-pulse flex flex-col gap-2 skeleton w-full">
|
<div
|
||||||
<div class="w-96 h-4"></div>
|
in:fly|global={{
|
||||||
|
duration: 500,
|
||||||
|
easing: expoOut,
|
||||||
|
y: 8,
|
||||||
|
delay: index * 25,
|
||||||
|
}}
|
||||||
|
class="animate-pulse flex flex-col gap-2 w-full
|
||||||
|
*:bg-slate-100 *:dark:bg-zinc-800 *:rounded-md"
|
||||||
|
>
|
||||||
|
<div class="w-96 h-3"></div>
|
||||||
<div class="w-full h-12"></div>
|
<div class="w-full h-12"></div>
|
||||||
<div class="w-48 h-4"></div>
|
<div class="w-48 h-4"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -496,9 +507,3 @@
|
|||||||
</EndPlaceholder>
|
</EndPlaceholder>
|
||||||
{/if}
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style lang="postcss">
|
|
||||||
.skeleton * {
|
|
||||||
@apply bg-slate-100 dark:bg-zinc-800 rounded-md;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -39,13 +39,14 @@
|
|||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||||
|
import { goto } from '$app/navigation'
|
||||||
|
|
||||||
type Result = PostView | CommentView | PersonView | CommunityView
|
type Result = PostView | CommentView | PersonView | CommunityView
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
let query = $state(data.query || '')
|
let query = $state(data.query || '')
|
||||||
let searchElement: HTMLInputElement = $state()
|
let searchElement: HTMLInputElement | undefined = $state()
|
||||||
|
|
||||||
let pageNum = $state(data.page)
|
let pageNum = $state(data.page)
|
||||||
|
|
||||||
@@ -71,14 +72,14 @@
|
|||||||
>
|
>
|
||||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
||||||
<form
|
<form
|
||||||
onsubmit={preventDefault(() =>
|
method="get"
|
||||||
searchParam($page.url, 'q', query, 'page'),
|
action="/search"
|
||||||
)}
|
|
||||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
bind:value={query}
|
bind:value={query}
|
||||||
bind:element={searchElement}
|
bind:element={searchElement}
|
||||||
|
name="q"
|
||||||
aria-label={$t('routes.search.query')}
|
aria-label={$t('routes.search.query')}
|
||||||
size="lg"
|
size="lg"
|
||||||
class="flex-1 !rounded-full h-full !text-base"
|
class="flex-1 !rounded-full h-full !text-base"
|
||||||
@@ -104,7 +105,7 @@
|
|||||||
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')}
|
||||||
>
|
>
|
||||||
{#snippet label()}
|
{#snippet customLabel()}
|
||||||
<span class="flex items-center gap-1">
|
<span class="flex items-center gap-1">
|
||||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||||
{$t('filter.type')}
|
{$t('filter.type')}
|
||||||
|
|||||||
Reference in new issue
Block a user