diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2024-03-12 19:18:52 +0000 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2024-03-12 19:18:52 +0000 |
| commit | a4052ffee8bc7c6c8a69eba5120b5c6c2d951b0f (patch) | |
| tree | 970921e587c0972ed4bf8a82a18bbad8dee10458 /components/editor/EditorSidebarItem.vue | |
| parent | addf95bc7e1e694cd9ba7797c8b0847bfecaf54c (diff) | |
Add items
Diffstat (limited to 'components/editor/EditorSidebarItem.vue')
| -rw-r--r-- | components/editor/EditorSidebarItem.vue | 66 |
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 |
