All checks were successful
Build and Deploy Nuxt / build (push) Successful in 1m20s
76 lines
1.5 KiB
Vue
76 lines
1.5 KiB
Vue
<script setup>
|
|
defineProps({
|
|
title: { type: String, default: '' },
|
|
subtitle: { type: String, default: '' },
|
|
link: { type: String, default: '' },
|
|
icon: { type: String, default: '' }
|
|
});
|
|
|
|
const emit = defineEmits(['select']);
|
|
|
|
function handleSelect() {
|
|
emit('select', { title: props.title, subtitle: props.subtitle, link: props.link });
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<button class="search-result" @click="handleSelect">
|
|
<div class="search-result-left">
|
|
<img v-if="icon" class="result-icon" :src="icon" alt="">
|
|
<span class="result-title">{{ title }}</span>
|
|
</div>
|
|
<span v-if="subtitle" class="result-subtitle">{{ subtitle }}</span>
|
|
</button>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.search-result {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 8px 12px;
|
|
background: none;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
color: inherit;
|
|
text-align: left;
|
|
font-family: inherit;
|
|
font-size: 14px;
|
|
transition: background-color 0.1s ease;
|
|
}
|
|
|
|
.search-result:hover,
|
|
.search-result.selected {
|
|
background-color: var(--color-search-hover);
|
|
}
|
|
|
|
.search-result-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.result-icon {
|
|
width: 14px;
|
|
height: 14px;
|
|
filter: invert(var(--color-icon-invert));
|
|
opacity: 0.6;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.result-title {
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.result-subtitle {
|
|
font-size: 12px;
|
|
opacity: 0.5;
|
|
flex-shrink: 0;
|
|
}
|
|
</style>
|