platform/plugins/contact-resources/src/components/ChannelsPresenter.svelte
Alexander Platov c2766b4e19
Update Telegram and Email layouts. Fix Channels. (#1639)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
2022-05-05 15:29:46 +07:00

41 lines
1.5 KiB
Svelte

<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// 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">
import type { Channel } from '@anticrm/contact'
import type { ButtonKind, ButtonSize } from '@anticrm/ui'
import ChannelsDropdown from './ChannelsDropdown.svelte'
import { showPopup } from '@anticrm/ui'
export let value: Channel[] | Channel | null
export let editable = false
export let kind: ButtonKind = 'link-bordered'
export let size: ButtonSize = 'small'
export let length: 'short' | 'full' = 'short'
export let shape: 'circle' | undefined = 'circle'
function _open (ev: any) {
if (ev.detail.presenter !== undefined && Array.isArray(value)) {
const channel = value[0]
if (channel !== undefined) {
showPopup(ev.detail.presenter, { _id: channel.attachedTo, _class: channel.attachedToClass }, 'float')
}
}
}
</script>
<ChannelsDropdown bind:value {length} {kind} {size} {shape} {editable} on:open={_open} />