elk/components/search/SearchResult.vue

24 lines
894 B
Vue
Raw Normal View History

2022-12-17 21:35:07 +00:00
<script setup lang="ts">
import type { SearchResult } from './types'
2023-01-05 16:48:20 +00:00
defineProps<{
result: SearchResult
active: boolean
}>()
2022-12-17 21:35:07 +00:00
const onActivate = () => {
(document.activeElement as HTMLElement).blur()
}
</script>
<template>
<CommonScrollIntoView as="RouterLink" :active="active" :to="result.to" py2 block px2 :aria-selected="active" :class="{ 'bg-active': active }" hover:bg-active @click="() => onActivate()">
2022-12-17 21:35:07 +00:00
<SearchHashtagInfo v-if="result.type === 'hashtag'" :hashtag="result.hashtag" />
2023-01-05 16:48:20 +00:00
<AccountInfo v-else-if="result.type === 'account' && result.account" :account="result.account" />
<StatusCard v-else-if="result.type === 'status' && result.status" :status="result.status" :actions="false" :show-reply-to="false" />
<!-- <div v-else-if="result.type === 'action'" text-center>
2022-12-17 21:35:07 +00:00
{{ result.action!.label }}
2023-01-05 16:48:20 +00:00
</div> -->
</CommonScrollIntoView>
2022-12-17 21:35:07 +00:00
</template>