blob: 2e7869f0032103406e233f46789c56ebbd34d8b7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<script lang="ts">
import { page } from '$app/stores';
import { getFilterContext } from '$lib/Filter';
import { navigate } from '$lib/Navigation';
import { slideXFast } from '$lib/Transitions';
import Badge from '$lib/components/Badge.svelte';
import { slide } from 'svelte/transition';
import { getToolbarContext } from './Toolbar.svelte';
const toolbar = getToolbarContext();
const filter = getFilterContext();
</script>
<div class="rounded-group flex">
<button
class:toggled={$toolbar.expand}
class="btn-slate relative"
title={`${$toolbar.expand ? 'Hide' : 'Show'} filters`}
on:click={() => ($toolbar.expand = !$toolbar.expand)}
>
{#if $toolbar.expand}
<span class="icon-base icon-[material-symbols--filter-alt]" />
{:else}
<span class="icon-base icon-[material-symbols--filter-alt-outline]" />
{/if}
<Badge number={$filter.include.size + $filter.exclude.size} />
</button>
{#if $filter.include.size + $filter.exclude.size > 0}
<button
class="btn-slate relative hover:bg-rose-700"
on:click={() => navigate({ filter: {} }, $page.url.searchParams)}
transition:slide={slideXFast}
title="Reset filters"
>
<div class="flex">
<span class="icon-base icon-[material-symbols--filter-alt-off]" />
</div>
</button>
{/if}
</div>
|