1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-16 23:58:00 +09:00
elk/components/account/AccountHoverWrapper.vue

27 lines
741 B
Vue
Raw Normal View History

2022-11-27 11:13:18 +09:00
<script setup lang="ts">
2023-01-08 15:21:09 +09:00
import type { mastodon } from 'masto'
2022-11-27 11:13:18 +09:00
2022-11-30 16:08:10 +09:00
const props = defineProps<{
2023-01-08 15:21:09 +09:00
account?: mastodon.v1.Account
2022-11-30 16:08:10 +09:00
handle?: string
2022-11-29 02:24:39 +09:00
disabled?: boolean
2022-11-27 11:13:18 +09:00
}>()
2022-11-30 16:08:10 +09:00
const account = computed(() => props.account || (props.handle ? useAccountByHandle(props.handle!) : undefined))
const userSettings = useUserSettings()
2022-11-30 18:49:07 +09:00
defineOptions({
inheritAttrs: false,
})
2022-11-27 11:13:18 +09:00
</script>
<template>
<VMenu v-if="!disabled && account && !getPreferences(userSettings, 'hideAccountHoverCard')" placement="bottom-start" :delay="{ show: 500, hide: 100 }" v-bind="$attrs" :close-on-content-click="false">
2022-11-27 11:13:18 +09:00
<slot />
<template #popper>
2022-11-30 16:08:10 +09:00
<AccountHoverCard v-if="account" :account="account" />
2022-11-27 11:13:18 +09:00
</template>
</VMenu>
2022-11-29 02:24:39 +09:00
<slot v-else />
2022-11-27 11:13:18 +09:00
</template>