mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-13 02:20:06 -04:00
Update SearchField.svelte
This commit is contained in:
parent
6181d99a50
commit
36d97f15cf
1 changed files with 21 additions and 2 deletions
|
@ -1,5 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { getContext } from 'svelte'
|
||||||
import { query, search, setSearchParam } from '../store.js'
|
import { query, search, setSearchParam } from '../store.js'
|
||||||
|
import SearchSyntaxPopup from './SearchSyntaxPopup.svelte'
|
||||||
|
|
||||||
|
const { open } = getContext('simple-modal')
|
||||||
|
|
||||||
export let found = 0
|
export let found = 0
|
||||||
export let isLoading = true
|
export let isLoading = true
|
||||||
|
@ -8,6 +12,14 @@
|
||||||
setSearchParam('q', $query)
|
setSearchParam('q', $query)
|
||||||
search($query)
|
search($query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showSearchSyntax = () => {
|
||||||
|
open(
|
||||||
|
SearchSyntaxPopup,
|
||||||
|
{},
|
||||||
|
{ transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } }
|
||||||
|
)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form class="mb-5" on:submit|preventDefault="{onSubmit}">
|
<form class="mb-5" on:submit|preventDefault="{onSubmit}">
|
||||||
|
@ -36,12 +48,19 @@
|
||||||
placeholder="Search for channels"
|
placeholder="Search for channels"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-2">
|
<div class="mt-2 flex justify-between">
|
||||||
<span class="inline-flex text-sm text-gray-500 dark:text-gray-400 font-mono"
|
<span class="inline-flex text-sm text-gray-500 dark:text-gray-400 font-mono"
|
||||||
>Found
|
>Found
|
||||||
<span class:animate-spin="{isLoading}">{ !isLoading ? found.toLocaleString() : '/' }</span>
|
<span class:animate-spin="{isLoading}">{ !isLoading ? found.toLocaleString() : '/' }</span>
|
||||||
channels</span
|
channels</span
|
||||||
>
|
>
|
||||||
</p>
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click|preventDefault="{showSearchSyntax}"
|
||||||
|
class="inline-flex text-sm text-gray-500 dark:text-gray-400 font-mono hover:underline hover:text-blue-500 dark:hover:text-blue-400"
|
||||||
|
>
|
||||||
|
Advanced search syntax
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue