aboutsummaryrefslogtreecommitdiff
path: root/src/modules/command-palette/components/command-palette-option.vue
diff options
context:
space:
mode:
authorGravatar Corentin THOMASSET <corentin.thomasset74@gmail.com> 2023-06-19 00:21:36 +0200
committerGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2023-06-19 00:35:50 +0200
commitbcb98b359c1a7fa39ee2bd72776dbb0434de150e (patch)
treeb17f8970d34fd7cdb5393a3703fb5dcc8d7b375c /src/modules/command-palette/components/command-palette-option.vue
parent732da08157a1bec9e203d40bba06cc67e28f29b4 (diff)
downloadit-tools-bcb98b359c1a7fa39ee2bd72776dbb0434de150e.tar.gz
it-tools-bcb98b359c1a7fa39ee2bd72776dbb0434de150e.tar.zst
it-tools-bcb98b359c1a7fa39ee2bd72776dbb0434de150e.zip
refactor(search): command palette design (#463)
Diffstat (limited to 'src/modules/command-palette/components/command-palette-option.vue')
-rw-r--r--src/modules/command-palette/components/command-palette-option.vue36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/modules/command-palette/components/command-palette-option.vue b/src/modules/command-palette/components/command-palette-option.vue
new file mode 100644
index 0000000..9192bc0
--- /dev/null
+++ b/src/modules/command-palette/components/command-palette-option.vue
@@ -0,0 +1,36 @@
+<script setup lang="ts">
+import type { PaletteOption } from '../command-palette.types';
+
+const props = withDefaults(defineProps<{ option: PaletteOption; selected?: boolean }>(), {
+ selected: false,
+});
+const emit = defineEmits(['activated']);
+const { option } = toRefs(props);
+
+const { selected } = toRefs(props);
+</script>
+
+<template>
+ <div
+ role="option"
+ :aria-selected="selected"
+ :class="{
+ 'text-white': selected,
+ 'bg-primary': selected,
+ }"
+ w-full flex cursor-pointer items-center overflow-hidden rounded pa-3 transition hover:bg-primary hover:text-white
+ @click="() => emit('activated', option)"
+ >
+ <component :is="option.icon" v-if="option.icon" mr-3 h-30px w-30px shrink-0 op-50 />
+
+ <div flex-1 overflow-hidden>
+ <div truncate font-bold lh-tight op-90>
+ {{ option.name }}
+ </div>
+
+ <div v-if="option.description" truncate lh-tight op-60>
+ {{ option.description }}
+ </div>
+ </div>
+ </div>
+</template>