2019-07-13 11:35:57 +02:00
|
|
|
<script>
|
|
|
|
import UIkit from "uikit";
|
|
|
|
|
|
|
|
export let isOpen = false;
|
|
|
|
export let onClosed = () => {};
|
2019-08-07 10:03:49 +02:00
|
|
|
export let id = "";
|
2019-07-13 11:35:57 +02:00
|
|
|
|
|
|
|
let ukModal;
|
|
|
|
let listenerAdded = false;
|
|
|
|
|
|
|
|
$: if(ukModal && !listenerAdded) {
|
|
|
|
listenerAdded = true;
|
|
|
|
ukModal.addEventListener("hide", onClosed);
|
|
|
|
}
|
|
|
|
|
|
|
|
$: {
|
|
|
|
if(ukModal) {
|
|
|
|
if(isOpen) {
|
|
|
|
UIkit.modal(ukModal).show();
|
|
|
|
} else {
|
|
|
|
UIkit.modal(ukModal).hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2019-08-07 10:03:49 +02:00
|
|
|
<div bind:this={ukModal} uk-modal {id}>
|
2019-07-13 11:35:57 +02:00
|
|
|
<div class="uk-modal-dialog uk-modal-body" uk-overflow-auto>
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
2019-09-19 20:47:18 +02:00
|
|
|
.uk-modal-dialog {
|
|
|
|
border-radius: .3rem;
|
|
|
|
}
|
|
|
|
|
2019-07-13 11:35:57 +02:00
|
|
|
</style>
|