From d1d654ebac2d51e3841675faeb56480e440f622f Mon Sep 17 00:00:00 2001
From: Wolfgang Müller
Date: Tue, 5 Mar 2024 18:08:09 +0100
Subject: Initial commit

---
 frontend/src/lib/toolbar/FilterFavourites.svelte | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 frontend/src/lib/toolbar/FilterFavourites.svelte

(limited to 'frontend/src/lib/toolbar/FilterFavourites.svelte')

diff --git a/frontend/src/lib/toolbar/FilterFavourites.svelte b/frontend/src/lib/toolbar/FilterFavourites.svelte
new file mode 100644
index 0000000..6591cef
--- /dev/null
+++ b/frontend/src/lib/toolbar/FilterFavourites.svelte
@@ -0,0 +1,24 @@
+<script lang="ts">
+	import { page } from '$app/stores';
+	import { ComicFilterContext, cycleBooleanFilter, getFilterContext } from '$lib/Filter';
+	import { accelerator } from '$lib/Shortcuts';
+	import Star from '$lib/icons/Star.svelte';
+
+	const filter = getFilterContext<ComicFilterContext>();
+	$: favourite = $filter.include.controls.favourite.value;
+
+	const toggle = () => {
+		$filter.include.controls.favourite.value = cycleBooleanFilter(favourite, false);
+		$filter.apply($page.url.searchParams);
+	};
+</script>
+
+<button
+	class:toggled={favourite}
+	class="btn-slate"
+	title="Filter favourites"
+	on:click={toggle}
+	use:accelerator={'f'}
+>
+	<Star {favourite} />
+</button>
-- 
cgit v1.2.3-2-gb3c3

