@textback/notification-widget
Version:
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
26 lines (19 loc) • 833 B
JavaScript
import t from '../../../libraries/t.js';
import './vk-modal.scss';
import vkTemplate from './vk-modal.html';
import vkIcon from '../../../widget/icons/icon_vk.svg';
export default class VKModal {
constructor(vkPluginContainerId) {
const modalContainer = document.createElement('div');
modalContainer.innerHTML = new t(vkTemplate).render({ vkPluginContainerId, vkIcon });
this.element = document.body.appendChild(modalContainer.firstChild);
this.element.querySelector('.tb-close').addEventListener('click', event => {
document.body.classList.remove('tb-modal-open');
document.body.removeChild(this.element);
if (this.onClose) {
this.onClose();
}
});
document.body.classList.add('tb-modal-open');
}
}