|
|
@ -24,11 +24,12 @@ export class Modal implements Modal {
|
|
|
|
if (event) {
|
|
|
|
if (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.modal.classList.add('modal-hiding');
|
|
|
|
this.modal.classList.add('animate-fade-out');
|
|
|
|
|
|
|
|
this.modal.classList.remove("animate-fade-in");
|
|
|
|
const modal = this.modal;
|
|
|
|
const modal = this.modal;
|
|
|
|
const listenerFunc = () => {
|
|
|
|
const listenerFunc = () => {
|
|
|
|
modal.classList.remove('modal-shown');
|
|
|
|
modal.classList.remove('block');
|
|
|
|
modal.classList.remove('modal-hiding');
|
|
|
|
modal.classList.remove('animate-fade-out');
|
|
|
|
modal.removeEventListener(window.animationEvent, listenerFunc);
|
|
|
|
modal.removeEventListener(window.animationEvent, listenerFunc);
|
|
|
|
document.dispatchEvent(this.closeEvent);
|
|
|
|
document.dispatchEvent(this.closeEvent);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -43,11 +44,11 @@ export class Modal implements Modal {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
show = () => {
|
|
|
|
show = () => {
|
|
|
|
this.modal.classList.add('modal-shown');
|
|
|
|
this.modal.classList.add('block', 'animate-fade-in');
|
|
|
|
document.dispatchEvent(this.openEvent);
|
|
|
|
document.dispatchEvent(this.openEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
toggle = () => {
|
|
|
|
toggle = () => {
|
|
|
|
if (this.modal.classList.contains('modal-shown')) {
|
|
|
|
if (this.modal.classList.contains('animate-fade-in')) {
|
|
|
|
this.close();
|
|
|
|
this.close();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.show();
|
|
|
|
this.show();
|
|
|
|