From a9072370ca1eb9a5cce928b1d487db0f307edea6 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Tue, 20 Sep 2022 15:24:27 +0800
Subject: feat: Move old apps into it's own directory

---
 old-apps/web-shared/src/components/chip.svelte | 50 ++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 old-apps/web-shared/src/components/chip.svelte

(limited to 'old-apps/web-shared/src/components/chip.svelte')

diff --git a/old-apps/web-shared/src/components/chip.svelte b/old-apps/web-shared/src/components/chip.svelte
new file mode 100644
index 0000000..7fbb445
--- /dev/null
+++ b/old-apps/web-shared/src/components/chip.svelte
@@ -0,0 +1,50 @@
+<script>
+	import {IconNames} from "$shared/lib/configuration";
+	import {createEventDispatcher} from "svelte";
+	import Button from "./button.svelte";
+
+	const dispatch = createEventDispatcher();
+	export let removable = false;
+	export let clickable = false;
+	export let text = "";
+	export let id = "";
+	export let color = "";
+	export let tabindex = "";
+
+	function handle_remove() {
+		if (removable) {
+			dispatch("remove", {
+				id
+			});
+		}
+	}
+
+	function handle_click() {
+		if (clickable) {
+			dispatch("clicked", {
+				id
+			});
+		}
+	}
+</script>
+
+<div class="chip break-word text-sm justify-between justify-start@md {clickable ? 'chip--interactive' : ''}"
+     on:click={handle_click}
+     id={id}
+     style={color !== "" ? `background-color: ${color}15; border: 1px solid ${color}; color: ${color}` : ""}
+     {tabindex}
+>
+    <span class="chip__label">{text}</span>
+
+    {#if removable}
+        <Button class="chip__btn"
+                variant="reset"
+                style="{color !== '' ? `background-color: ${color}45;` : ''}"
+                {tabindex}
+                icon="{IconNames.x}"
+                icon_width="initial"
+                icon_height="initial"
+                on:click={handle_remove}
+        />
+    {/if}
+</div>
-- 
cgit v1.3

