forked from Mirrors/elk
refactor: extract account avatar
This commit is contained in:
parent
910c585a55
commit
b58d204199
3 changed files with 25 additions and 14 deletions
|
@ -12,16 +12,12 @@ defineOptions({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div relative flex-shrink-0>
|
<div v-if="hover" relative flex-shrink-0>
|
||||||
<div group>
|
<div group>
|
||||||
<AccountHoverCard v-if="hover" top="-3.2" left="-4.4" absolute :account="account" op0 pointer-events-none group-hover="pointer-events-auto op100 scale-100" delay-250 transition transform scale-20 class="ease-[cubic-bezier(0.4, 0.0, 0.2, 1)]" />
|
<AccountHoverCard top="-3.2" left="-4.4" absolute :account="account" op0 pointer-events-none group-hover="pointer-events-auto op100 scale-100" delay-250 transition transform scale-20 class="ease-[cubic-bezier(0.4, 0.0, 0.2, 1)]" />
|
||||||
<img
|
<AccountAvatarImage :account="account" v-bind="$attrs" />
|
||||||
:src="account.avatar"
|
|
||||||
:alt="account.username"
|
|
||||||
loading="lazy"
|
|
||||||
rounded-full bg-gray:10
|
|
||||||
v-bind="$attrs"
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AccountAvatarImage v-else :account="account" v-bind="$attrs" />
|
||||||
</template>
|
</template>
|
||||||
|
|
17
components/account/AccountAvatarImage.vue
Normal file
17
components/account/AccountAvatarImage.vue
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { Account } from 'masto'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
account: Account
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<img
|
||||||
|
:src="account.avatar"
|
||||||
|
:alt="account.username"
|
||||||
|
loading="lazy"
|
||||||
|
rounded-full bg-gray:10
|
||||||
|
v-bind="$attrs"
|
||||||
|
>
|
||||||
|
</template>
|
|
@ -53,11 +53,9 @@ function getFieldNameIcon(fieldName: string) {
|
||||||
<div p4 mt--17 flex flex-col gap-6>
|
<div p4 mt--17 flex flex-col gap-6>
|
||||||
<div flex justify-between>
|
<div flex justify-between>
|
||||||
<div flex="~ col gap-2 1" min-w-0>
|
<div flex="~ col gap-2 1" min-w-0>
|
||||||
<div>
|
<NuxtLink w-fit :to="getAccountPath(account)">
|
||||||
<NuxtLink :to="getAccountPath(account)">
|
<AccountAvatar :account="account" w-30 h-30 />
|
||||||
<AccountAvatar :account="account" w-30 h-30 />
|
</NuxtLink>
|
||||||
</NuxtLink>
|
|
||||||
</div>
|
|
||||||
<div flex flex-col>
|
<div flex flex-col>
|
||||||
<ContentRichSetup font-bold text-2xl break-words :content="getDisplayName(account)" :emojis="account.emojis" />
|
<ContentRichSetup font-bold text-2xl break-words :content="getDisplayName(account)" :emojis="account.emojis" />
|
||||||
<p op50>
|
<p op50>
|
||||||
|
|
Loading…
Reference in a new issue