2022-04-14 11:04:24 +00:00
|
|
|
<!--
|
|
|
|
// Copyright © 2020 Anticrm Platform Contributors.
|
|
|
|
//
|
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2022-09-21 08:08:25 +00:00
|
|
|
import type { Class, Doc, Ref } from '@hcengineering/core'
|
2023-03-05 17:36:12 +00:00
|
|
|
import { Person as Contact } from '@hcengineering/contact'
|
2022-04-14 11:04:24 +00:00
|
|
|
import Avatar from './Avatar.svelte'
|
2022-09-21 08:08:25 +00:00
|
|
|
import { IconSize } from '@hcengineering/ui'
|
2023-03-22 02:48:57 +00:00
|
|
|
import { createQuery } from '@hcengineering/presentation'
|
2022-04-14 11:04:24 +00:00
|
|
|
|
|
|
|
export let _class: Ref<Class<Doc>>
|
2023-03-05 17:36:12 +00:00
|
|
|
export let items: Ref<Contact>[] = []
|
2022-05-16 11:41:22 +00:00
|
|
|
export let size: IconSize
|
2022-04-14 11:04:24 +00:00
|
|
|
export let limit: number = 3
|
|
|
|
|
2023-03-05 17:36:12 +00:00
|
|
|
let persons: Contact[] = []
|
2022-04-14 11:04:24 +00:00
|
|
|
const query = createQuery()
|
2023-03-05 17:36:12 +00:00
|
|
|
$: query.query<Contact>(
|
2022-04-29 05:27:17 +00:00
|
|
|
_class,
|
|
|
|
{ _id: { $in: items } },
|
|
|
|
(result) => {
|
|
|
|
persons = result
|
|
|
|
},
|
|
|
|
{ limit }
|
|
|
|
)
|
2022-04-14 11:04:24 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="avatars-container">
|
|
|
|
{#each persons as person}
|
|
|
|
<div class="combine-avatar {size}">
|
|
|
|
<Avatar avatar={person.avatar} {size} />
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.avatars-container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
2022-04-29 05:27:17 +00:00
|
|
|
.combine-avatar.inline:not(:first-child) {
|
|
|
|
margin-left: calc(1px - (0.875rem / 2));
|
|
|
|
}
|
|
|
|
.combine-avatar.x-small:not(:first-child) {
|
|
|
|
margin-left: calc(1px - (1.5rem / 2));
|
|
|
|
}
|
|
|
|
.combine-avatar.small:not(:first-child) {
|
|
|
|
margin-left: calc(1px - 1rem);
|
|
|
|
}
|
|
|
|
.combine-avatar.medium:not(:first-child) {
|
|
|
|
margin-left: calc(1px - (2.25rem / 2));
|
|
|
|
}
|
|
|
|
.combine-avatar.large:not(:first-child) {
|
|
|
|
margin-left: calc(1px - (4.5rem / 2));
|
|
|
|
}
|
|
|
|
.combine-avatar.x-large:not(:first-child) {
|
|
|
|
margin-left: calc(1px - (7.5rem / 2));
|
|
|
|
}
|
|
|
|
.combine-avatar:not(:last-child) {
|
|
|
|
mask: radial-gradient(circle at 100% 50%, rgba(0, 0, 0, 0) 48.5%, rgb(0, 0, 0) 50%);
|
|
|
|
}
|
2022-04-14 11:04:24 +00:00
|
|
|
}
|
2022-04-29 05:27:17 +00:00
|
|
|
</style>
|