aboutsummaryrefslogtreecommitdiffstats
path: root/components/editor/EditorSidebarItem.vue
diff options
context:
space:
mode:
Diffstat (limited to 'components/editor/EditorSidebarItem.vue')
-rw-r--r--components/editor/EditorSidebarItem.vue66
1 files changed, 66 insertions, 0 deletions
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