2019-12-04 23:13:06 +01:00
|
|
|
<script>
|
2020-02-03 10:50:30 +01:00
|
|
|
import UIkit from "uikit"
|
2020-02-24 16:00:48 +01:00
|
|
|
import ActionButton from "../common/ActionButton.svelte"
|
2019-12-04 23:13:06 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
export let isOpen = false
|
2020-03-20 19:47:01 +01:00
|
|
|
export let onClosed
|
2020-02-03 10:50:30 +01:00
|
|
|
export let id = ""
|
2020-02-24 17:41:02 +01:00
|
|
|
export let title
|
2019-12-04 23:13:06 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
let ukModal
|
|
|
|
let listenerAdded = false
|
2019-12-04 23:13:06 +01:00
|
|
|
|
2020-01-31 10:45:02 +01:00
|
|
|
$: {
|
|
|
|
if (ukModal && !listenerAdded) {
|
2020-02-03 10:50:30 +01:00
|
|
|
listenerAdded = true
|
|
|
|
ukModal.addEventListener("hidden", onClosed)
|
2019-12-04 23:13:06 +01:00
|
|
|
}
|
|
|
|
|
2020-01-31 10:45:02 +01:00
|
|
|
if (ukModal) {
|
|
|
|
if (isOpen) {
|
2020-02-03 10:50:30 +01:00
|
|
|
UIkit.modal(ukModal).show()
|
2020-01-31 10:45:02 +01:00
|
|
|
} else {
|
2020-02-03 10:50:30 +01:00
|
|
|
UIkit.modal(ukModal).hide()
|
2020-01-31 10:45:02 +01:00
|
|
|
}
|
2019-12-04 23:13:06 +01:00
|
|
|
}
|
2020-01-31 10:45:02 +01:00
|
|
|
}
|
2019-12-04 23:13:06 +01:00
|
|
|
</script>
|
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
<div bind:this={ukModal} uk-modal {id}>
|
2020-03-20 19:47:01 +01:00
|
|
|
{#if isOpen}
|
|
|
|
<div class="uk-modal-dialog" uk-overflow-auto>
|
|
|
|
{#if title}
|
|
|
|
<div class="uk-modal-header">
|
|
|
|
<h4 class="budibase__title--4">{title}</h4>
|
|
|
|
</div>
|
2020-02-24 17:41:02 +01:00
|
|
|
{/if}
|
2020-03-20 19:47:01 +01:00
|
|
|
<div class="uk-modal-body">
|
|
|
|
{#if onClosed}
|
|
|
|
<button class="uk-modal-close-default" type="button" uk-close />
|
|
|
|
{/if}
|
|
|
|
<slot />
|
|
|
|
</div>
|
2020-03-22 14:59:42 +01:00
|
|
|
<div class="uk-modal-footer">
|
|
|
|
<slot name="footer" />
|
|
|
|
</div>
|
2020-02-24 17:41:02 +01:00
|
|
|
</div>
|
2020-03-20 19:47:01 +01:00
|
|
|
{/if}
|
2020-02-03 10:50:30 +01:00
|
|
|
</div>
|
|
|
|
|
2019-12-04 23:13:06 +01:00
|
|
|
<style>
|
2020-01-31 10:45:02 +01:00
|
|
|
.uk-modal-dialog {
|
|
|
|
border-radius: 0.3rem;
|
2020-06-02 20:59:58 +02:00
|
|
|
width: 520px;
|
2020-01-30 22:00:19 +01:00
|
|
|
height: 80vh;
|
2020-01-31 10:45:02 +01:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2020-06-02 20:59:58 +02:00
|
|
|
padding: 40px;
|
2020-01-31 10:45:02 +01:00
|
|
|
}
|
|
|
|
</style>
|