feat: add hover card for user list

pull/188/head^2
三咲智子 2022-11-29 01:24:39 +08:00
rodzic fd3e758336
commit d2c4d62cf5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 69992F2250DFD93E
4 zmienionych plików z 14 dodań i 3 usunięć

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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 />

Wyświetl plik

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