fix basicusercard

This commit is contained in:
Henry Jameson 2022-06-27 19:26:52 +03:00
parent cb135645f9
commit 700df11e9a
4 changed files with 18 additions and 29 deletions

View File

@ -1,4 +1,4 @@
import UserCard from '../user_card/user_card.vue' import UserPopover from '../user_popover/user_popover.vue'
import UserAvatar from '../user_avatar/user_avatar.vue' import UserAvatar from '../user_avatar/user_avatar.vue'
import RichContent from 'src/components/rich_content/rich_content.jsx' import RichContent from 'src/components/rich_content/rich_content.jsx'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
@ -7,20 +7,12 @@ const BasicUserCard = {
props: [ props: [
'user' 'user'
], ],
data () {
return {
userExpanded: false
}
},
components: { components: {
UserCard, UserPopover,
UserAvatar, UserAvatar,
RichContent RichContent
}, },
methods: { methods: {
toggleUserExpanded () {
this.userExpanded = !this.userExpanded
},
userProfileLink (user) { userProfileLink (user) {
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
} }

View File

@ -1,24 +1,19 @@
<template> <template>
<div class="basic-user-card"> <div class="basic-user-card">
<router-link :to="userProfileLink(user)"> <router-link @click.prevent :to="userProfileLink(user)">
<UserAvatar <UserPopover
class="avatar" :userId="user.id"
:user="user" :overlayCenters="true"
@click.prevent="toggleUserExpanded" overlayCentersSelector=".avatar"
/> >
<UserAvatar
class="user-avatar avatar"
:user="user"
@click.prevent
/>
</UserPopover>
</router-link> </router-link>
<div <div
v-if="userExpanded"
class="basic-user-card-expanded-content"
>
<UserCard
:user-id="user.id"
:rounded="true"
:bordered="true"
/>
</div>
<div
v-else
class="basic-user-card-collapsed-content" class="basic-user-card-collapsed-content"
> >
<div <div
@ -53,6 +48,8 @@
margin: 0; margin: 0;
padding: 0.6em 1em; padding: 0.6em 1em;
--emoji-size: 14px;
&-collapsed-content { &-collapsed-content {
margin-left: 0.7em; margin-left: 0.7em;
text-align: left; text-align: left;

View File

@ -4,7 +4,7 @@ import { defineAsyncComponent } from 'vue'
const UserPopover = { const UserPopover = {
name: 'UserPopover', name: 'UserPopover',
props: [ props: [
'userId', 'overlayCenters', 'disabled' 'userId', 'overlayCenters', 'disabled', 'overlay-centers-selector'
], ],
components: { components: {
UserCard, UserCard,

View File

@ -2,7 +2,7 @@
<Popover <Popover
trigger="click" trigger="click"
popover-class="popover-default user-popover" popover-class="popover-default user-popover"
overlay-centers-selector=".user-info-avatar-link .Avatar" :overlay-centers-selector="overlayCentersSelector || '.user-info-avatar-link .Avatar'"
:overlay-centers="overlayCenters" :overlay-centers="overlayCenters"
:disabled="disabled" :disabled="disabled"
> >