From d835db8bda13aa16c64cd51dc6e07a56d1159b33 Mon Sep 17 00:00:00 2001 From: Tamara Steinwender <tamara.steinwender@tugraz.at> Date: Wed, 23 Nov 2022 16:35:31 +0100 Subject: [PATCH] Improve modal webcomponent --- packages/common/src/modal.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/common/src/modal.js b/packages/common/src/modal.js index 48980b25..ac8d36ad 100644 --- a/packages/common/src/modal.js +++ b/packages/common/src/modal.js @@ -14,6 +14,8 @@ export class Modal extends DBPLitElement { this.lang = this._i18n.language; this.modalId = 'dbp-modal-id'; this.title = "Modal Title"; + + // TODO add with/height } static get properties() { @@ -39,6 +41,10 @@ export class Modal extends DBPLitElement { }); } + close() { + MicroModal.close(this._('#' + this.modalId)); + } + static get styles() { // language=css return css` @@ -93,9 +99,7 @@ export class Modal extends DBPLitElement { title="${i18n.t('dbp-modal.close')}" class="modal-close" aria-label="Close modal" - @click="${() => { - MicroModal.close(this._('#' + this.modalId)); - }}"> + @click="${() => {this.close()}}"> <dbp-icon title="${i18n.t('dbp-modal.close')}" name="close" -- GitLab