From 2aca4247c5d0c7061a300517178dd31316b65fab Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Thu, 15 Feb 2024 14:01:30 +0000
Subject: Initial commit

---
 src/components/Control/TrueFalseSwitch.vue | 54 ++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 src/components/Control/TrueFalseSwitch.vue

(limited to 'src/components/Control/TrueFalseSwitch.vue')

diff --git a/src/components/Control/TrueFalseSwitch.vue b/src/components/Control/TrueFalseSwitch.vue
new file mode 100644
index 0000000..a0a3392
--- /dev/null
+++ b/src/components/Control/TrueFalseSwitch.vue
@@ -0,0 +1,54 @@
+<script setup lang="ts">
+import { ref } from 'vue';
+
+const props = defineProps<{
+  value: boolean;
+}>();
+const emit = defineEmits(['update']);
+
+const value = ref(props.value);
+
+const invert = () => {
+  value.value = !value.value;
+  emit('update', value.value);
+};
+</script>
+
+<template>
+  <div class="switch" @click="invert">
+    <span v-if="value" class="true"><font-awesome-icon :icon="['fas', 'fa-check']" /> True</span>
+    <span v-else class="false"><font-awesome-icon :icon="['fas', 'fa-xmark']" /> False</span>
+  </div>
+</template>
+
+<style scoped>
+.switch {
+  display: flex;
+  width: 100%;
+  height: 100%;
+  cursor: pointer;
+  align-items: center;
+  padding: 0.5rem;
+  user-select: none;
+  transition: background-color 0.3s;
+  background-color: var(--color-background-soft);
+  
+  span {
+    font-family: monospace;
+    font-size: 0.8rem;
+  }
+  
+  .true {
+    color: var(--color-text-primary);
+  }
+
+  .false {
+    color: var(--color-false);
+  }
+  
+  &:hover {
+    background-color: var(--color-hover);
+  }
+}
+
+</style>
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2

