From a4052ffee8bc7c6c8a69eba5120b5c6c2d951b0f Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Tue, 12 Mar 2024 19:18:52 +0000
Subject: Add items

---
 components/editor/EditorSidebarItem.vue | 66 +++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 components/editor/EditorSidebarItem.vue

(limited to 'components/editor/EditorSidebarItem.vue')

diff --git a/components/editor/EditorSidebarItem.vue b/components/editor/EditorSidebarItem.vue
new file mode 100644
index 0000000..4696bb1
--- /dev/null
+++ b/components/editor/EditorSidebarItem.vue
@@ -0,0 +1,66 @@
+<script setup lang="ts">
+import { computed, toRefs } from 'vue';
+
+const props = defineProps<{
+  item: EditorItem;
+}>();
+
+const { item } = toRefs(props);
+
+const route = useRoute();
+
+const setSelectedItem = () => {
+  navigateTo({ path: `/item/${item.value.id}` })
+};
+
+const selected = computed(() => {
+  return route.path.startsWith('/item') && route.params.id === item.value.id;
+});
+</script>
+
+<template>
+  <div id="item-container" @click.stop="setSelectedItem" :class="{ selected: selected }">
+    <span id="item-title">
+      <font-awesome-icon class="item-icon" :icon="['fas', 'cube']" />
+      <span id="item-name">
+        <span id="item-display-id">{{ item.id }}</span>
+        <code id="item-display-type">{{ item.type }}</code>
+      </span>
+    </span>
+  </div>
+</template>
+
+<style scoped>
+#item-container {
+  cursor: pointer;
+  padding: 0.3rem 1rem;
+  transition: background-color 0.3s;
+
+  #item-title {
+    display: flex;
+    align-items: center;
+    margin: 0;
+    gap: 0.6rem;
+    font-size: 0.8rem;
+
+    #item-name {
+      display: flex;
+      flex-direction: column;
+      align-items: left;
+
+      #item-display-type {
+        font-size: 0.6rem;
+        color: var(--color-text-mute);
+      }
+    }
+  }
+}
+
+.selected {
+  background-color: var(--color-primary-mute) !important;
+}
+
+#item-container:hover {
+  background-color: var(--color-hover);
+}
+</style>
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2

