From 6908dbff40351f6cbc712247f0009baf7fc68b8a Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 9 Sep 2023 22:07:49 -0700
Subject: refactor(settings): component toggles

---
 src/lib/SettingToggle.svelte | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 src/lib/SettingToggle.svelte

(limited to 'src/lib/SettingToggle.svelte')

diff --git a/src/lib/SettingToggle.svelte b/src/lib/SettingToggle.svelte
new file mode 100644
index 00000000..fffb854f
--- /dev/null
+++ b/src/lib/SettingToggle.svelte
@@ -0,0 +1,19 @@
+<script lang="ts">
+	import settings, { type Settings } from '../stores/settings';
+
+	export let setting: keyof Settings;
+	export let on = '';
+	export let off = '';
+	export let lineBreak = true;
+</script>
+
+<a
+	href={'#'}
+	on:click={() =>
+		$settings[setting] ? settings.setKey(setting, false) : settings.setKey(setting, true)}
+	>{$settings[setting] ? on : off} <slot /></a
+>
+
+{#if lineBreak}
+	<br />
+{/if}
-- 
cgit v1.2.3

