pleroma-fe/src/components/basic_user_card/basic_user_card.vue

94 lines
1.8 KiB
Vue
Raw Normal View History

<template>
<div class="basic-user-card">
<router-link :to="userProfileLink(user)">
<UserAvatar
class="avatar"
:user="user"
@click.prevent.native="toggleUserExpanded"
/>
</router-link>
2019-07-05 17:17:44 +10:00
<div
v-if="userExpanded"
class="basic-user-card-expanded-content"
>
<UserCard
:user="user"
:rounded="true"
:bordered="true"
/>
</div>
2019-07-05 17:17:44 +10:00
<div
v-else
class="basic-user-card-collapsed-content"
>
<div
:title="user.name"
class="basic-user-card-user-name"
>
2019-07-07 07:54:17 +10:00
<!-- eslint-disable vue/no-v-html -->
2019-07-05 17:17:44 +10:00
<span
v-if="user.name_html"
class="basic-user-card-user-name-value"
v-html="user.name_html"
/>
2019-07-07 07:54:17 +10:00
<!-- eslint-enable vue/no-v-html -->
2019-07-05 17:17:44 +10:00
<span
v-else
class="basic-user-card-user-name-value"
>{{ user.name }}</span>
</div>
<div>
2019-07-05 17:17:44 +10:00
<router-link
class="basic-user-card-screen-name"
:to="userProfileLink(user)"
>
@{{ user.screen_name }}
</router-link>
</div>
2019-07-05 17:17:44 +10:00
<slot />
</div>
</div>
</template>
<script src="./basic_user_card.js"></script>
<style lang="scss">
.basic-user-card {
display: flex;
flex: 1 0;
2019-03-05 18:32:23 +11:00
margin: 0;
2019-04-04 14:42:24 +11:00
padding: 0.6em 1em;
&-collapsed-content {
margin-left: 0.7em;
text-align: left;
flex: 1;
2019-03-01 04:48:14 +11:00
min-width: 0;
}
&-user-name {
img {
object-fit: contain;
height: 16px;
width: 16px;
vertical-align: middle;
}
}
&-user-name-value,
&-screen-name {
display: inline-block;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
&-expanded-content {
flex: 1;
2019-02-26 14:50:34 +11:00
margin-left: 0.7em;
2019-08-13 03:59:39 +10:00
min-width: 0;
}
}
</style>