From 1d114affa1f09e9dd13a0163c27bf3ef38ac98f6 Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Thu, 9 Jun 2022 19:00:12 -0500
Subject: SVG wrapper component `Icon.svelte` for storing all SVGs, allowing
 SVG paths to be hidden away in one file

---
 src/components/helpers/Icon.svelte | 44 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 src/components/helpers/Icon.svelte

(limited to 'src/components/helpers/Icon.svelte')

diff --git a/src/components/helpers/Icon.svelte b/src/components/helpers/Icon.svelte
new file mode 100644
index 0000000..eb430fb
--- /dev/null
+++ b/src/components/helpers/Icon.svelte
@@ -0,0 +1,44 @@
+<script>
+    export let name;
+    export let width = "1rem";
+    export let height = "1rem";
+    export let focusable = false;
+    let icons = [
+        {
+            box: 24,
+            name: "plus-circle",
+            path: `<path
+                        stroke-linecap="round"
+                        stroke-linejoin="round"
+                        d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
+                    />`,
+        },
+        {
+            box: 24,
+            name: "minus-circle",
+            path: `<path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" />`,
+        },
+        {
+            name: "info",
+            box: 24,
+            path: `<path
+                    stroke-linecap="round"
+                    stroke-linejoin="round"
+                    d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
+                />`,
+        },
+    ];
+    let displayIcon = icons.find((e) => e.name === name);
+</script>
+
+<svg
+    class={$$props.class}
+    xmlns="http://www.w3.org/2000/svg"
+    fill="none"
+    viewBox="0 0 {displayIcon.box} {displayIcon.box}"
+    stroke="currentColor"
+    stroke-width={2}
+    {width}
+    {height}
+    {focusable}>{@html displayIcon.path}</svg
+>
-- 
cgit v1.2.3

