firefish/packages/client/src/components/MkUsersTooltip.vue

60 lines
1.1 KiB
Vue
Raw Normal View History

<template>
2023-04-08 00:01:42 +00:00
<MkTooltip
ref="tooltip"
:target-element="targetElement"
:max-width="250"
2024-04-12 14:02:03 +00:00
:showing="showing"
2024-04-17 20:34:23 +00:00
@closed="emit('closed')"
2023-04-08 00:01:42 +00:00
>
<div class="beaffaef">
<div v-for="u in users" :key="u.id" class="user">
2023-09-01 23:27:33 +00:00
<MkAvatar class="avatar" :user="u" disable-link />
2023-04-08 00:01:42 +00:00
<MkUserName class="name" :user="u" :nowrap="true" />
</div>
<div v-if="users.length < count" class="omitted">
+{{ count - users.length }}
</div>
2021-11-14 04:13:22 +00:00
</div>
2023-04-08 00:01:42 +00:00
</MkTooltip>
</template>
<script lang="ts" setup>
2024-04-12 14:02:03 +00:00
import type { entities } from "firefish-js";
2024-04-17 20:34:23 +00:00
import MkTooltip from "./MkTooltip.vue";
2023-10-31 11:19:05 +00:00
defineProps<{
showing: boolean;
2024-04-12 14:02:03 +00:00
users: entities.User[];
count: number;
2024-04-12 14:02:03 +00:00
targetElement?: HTMLElement;
}>();
const emit = defineEmits<{
2023-04-08 00:01:42 +00:00
(ev: "closed"): void;
}>();
</script>
<style lang="scss" scoped>
2021-11-14 04:13:22 +00:00
.beaffaef {
font-size: 0.9em;
2021-11-14 04:13:22 +00:00
text-align: left;
> .user {
line-height: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&:not(:last-child) {
margin-bottom: 3px;
}
> .avatar {
width: 24px;
height: 24px;
margin-right: 3px;
}
}
}
</style>