1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-07-05 22:16:49 +01:00

feat: add hover card for user list

This commit is contained in:
三咲智子 2022-11-29 01:24:39 +08:00
parent fd3e758336
commit d2c4d62cf5
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
4 changed files with 14 additions and 3 deletions

View file

@ -3,6 +3,7 @@ import type { Account } from 'masto'
const { account } = defineProps<{
account: Account
hoverCard?: boolean
}>()
cacheAccount(account)
@ -10,7 +11,11 @@ cacheAccount(account)
<template>
<div flex justify-between hover:bg-active transition-100>
<AccountInfo :account="account" hover p1 as="router-link" :to="getAccountPath(account)" />
<AccountInfo
:account="account" hover p1 as="router-link"
:hover-card="hoverCard"
:to="getAccountPath(account)"
/>
<div h-full p1>
<AccountFollowButton :account="account" />
</div>

View file

@ -3,14 +3,16 @@ import type { Account } from 'masto'
defineProps<{
account: Account
disabled?: boolean
}>()
</script>
<template>
<VMenu placement="bottom-start" :delay="{ show: 500, hide: 100 }">
<VMenu v-if="!disabled" placement="bottom-start" :delay="{ show: 500, hide: 100 }">
<slot />
<template #popper>
<AccountHoverCard :account="account" />
</template>
</VMenu>
<slot v-else />
</template>

View file

@ -4,6 +4,7 @@ import type { Account } from 'masto'
const { account, as = 'div' } = defineProps<{
account: Account
as?: string
hoverCard?: boolean
}>()
defineOptions({
@ -15,7 +16,9 @@ defineOptions({
<!-- This is sometimes (like in the sidebar) used directly as a button, and sometimes, like in follow notifications, as a link. I think this component may need a second refactor that either lets an implementation pass in a link or an action and adapt to what's passed in, or the implementations need to be updated to wrap in the action they want to take and this be just the layout for these items -->
<template>
<component :is="as" flex gap-3 v-bind="$attrs">
<AccountAvatar :account="account" w-12 h-12 />
<AccountHoverWrapper :disabled="!hoverCard" :account="account">
<AccountAvatar :account="account" w-12 h-12 />
</AccountHoverWrapper>
<div flex="~ col">
<ContentRich font-bold :content="getDisplayName(account, { rich: true })" :emojis="account.emojis" />
<AccountHandle :account="account" text-sm />

View file

@ -11,6 +11,7 @@ const { paginator } = defineProps<{
<template #default="{ item }">
<AccountCard
:account="item"
hover-card
border="b base" py2 px4
/>
</template>