tweb/src/components/popups/peer.ts

28 lines
876 B
TypeScript
Raw Normal View History

import AvatarElement from "../avatar";
import PopupElement, { PopupButton } from ".";
export default class PopupPeer extends PopupElement {
constructor(private className: string, options: Partial<{
peerId: number,
title: string,
description: string,
buttons: Array<PopupButton>
}> = {}) {
2021-03-19 13:14:42 +01:00
super('popup-peer' + (className ? ' ' + className : ''), options.buttons, {overlayClosable: true});
let avatarEl = new AvatarElement();
avatarEl.setAttribute('dialog', '1');
avatarEl.setAttribute('peer', '' + options.peerId);
avatarEl.classList.add('avatar-32');
this.title.innerText = options.title || '';
this.header.prepend(avatarEl);
let p = document.createElement('p');
p.classList.add('popup-description');
p.innerHTML = options.description;
this.container.insertBefore(p, this.header.nextElementSibling);
}
2021-03-13 04:53:19 +01:00
}