elk/components/search/SearchResult.vue

32 lines
904 B
Vue
Raw Normal View History

2022-12-18 00:35:07 +03:00
<script setup lang="ts">
2023-01-07 17:52:58 +03:00
import type { SearchResult } from '~/composables/masto/search'
2023-01-05 19:48:20 +03:00
defineProps<{
result: SearchResult
active: boolean
}>()
2022-12-18 00:35:07 +03:00
function onActivate() {
2022-12-18 00:35:07 +03:00
(document.activeElement as HTMLElement).blur()
}
</script>
<template>
2023-01-06 01:50:14 +03:00
<CommonScrollIntoView
as="RouterLink"
hover:bg-active
:active="active"
:to="result.to" py2 block px2
:aria-selected="active"
:class="{ 'bg-active': active }"
@click="() => onActivate()"
>
2023-01-07 17:52:58 +03:00
<SearchHashtagInfo v-if="result.type === 'hashtag'" :hashtag="result.data" />
<SearchAccountInfo v-else-if="result.type === 'account'" :account="result.data" />
<StatusCard v-else-if="result.type === 'status'" :status="result.data" :actions="false" :show-reply-to="false" />
2023-01-05 19:48:20 +03:00
<!-- <div v-else-if="result.type === 'action'" text-center>
2022-12-18 00:35:07 +03:00
{{ result.action!.label }}
2023-01-05 19:48:20 +03:00
</div> -->
</CommonScrollIntoView>
2022-12-18 00:35:07 +03:00
</template>