2024-09-07 08:38:18 +01:00
|
|
|
<script setup lang="ts">
|
2023-01-07 14:52:58 +00:00
|
|
|
import type { ResolvedCommand } from '~/composables/command'
|
2022-12-28 16:29:07 +00:00
|
|
|
|
|
|
|
const {
|
|
|
|
cmd,
|
|
|
|
index,
|
|
|
|
active = false,
|
2024-02-21 15:20:08 +00:00
|
|
|
} = defineProps<{
|
2022-12-28 16:29:07 +00:00
|
|
|
cmd: ResolvedCommand
|
|
|
|
index: number
|
|
|
|
active?: boolean
|
|
|
|
}>()
|
2024-02-21 15:20:08 +00:00
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(event: 'activate'): void
|
|
|
|
}>()
|
2022-12-28 16:29:07 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="flex px-3 py-2 my-1 items-center rounded-lg hover:bg-active transition-all duration-65 ease-in-out cursor-pointer scroll-m-10"
|
|
|
|
:class="{ 'bg-active': active }"
|
|
|
|
:data-index="index"
|
2023-01-01 22:06:27 +00:00
|
|
|
@click="emit('activate')"
|
2022-12-28 16:29:07 +00:00
|
|
|
>
|
2023-01-01 14:29:11 +00:00
|
|
|
<div v-if="cmd.icon" me-2 :class="cmd.icon" />
|
2022-12-28 16:29:07 +00:00
|
|
|
|
|
|
|
<div class="flex-1 flex items-baseline gap-2">
|
|
|
|
<div :class="{ 'font-medium': active }">
|
|
|
|
{{ cmd.name }}
|
|
|
|
</div>
|
|
|
|
<div v-if="cmd.description" class="text-xs text-secondary">
|
|
|
|
{{ cmd.description }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
|
|
|
v-if="cmd.onComplete"
|
|
|
|
class="flex items-center gap-1 transition-all duration-65 ease-in-out"
|
|
|
|
:class="active ? 'opacity-100' : 'opacity-0'"
|
|
|
|
>
|
|
|
|
<div class="text-xs text-secondary">
|
|
|
|
{{ $t('command.complete') }}
|
|
|
|
</div>
|
|
|
|
<CommandKey name="Tab" />
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-if="cmd.onActivate"
|
|
|
|
class="flex items-center gap-1 transition-all duration-65 ease-in-out"
|
|
|
|
:class="active ? 'opacity-100' : 'opacity-0'"
|
|
|
|
>
|
|
|
|
<div class="text-xs text-secondary">
|
|
|
|
{{ $t('command.activate') }}
|
|
|
|
</div>
|
|
|
|
<CommandKey name="Enter" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|