2018-09-12 08:22:17 +02:00
|
|
|
<template>
|
|
|
|
<transition name="modal">
|
|
|
|
<div class="modal-mask">
|
2021-01-16 22:15:48 +01:00
|
|
|
<div class="modal-container" @click.prevent.stop="$emit('close')">
|
2018-09-12 08:22:17 +02:00
|
|
|
<div class="modal-content">
|
2021-01-16 22:15:48 +01:00
|
|
|
<slot>
|
2018-09-12 08:22:17 +02:00
|
|
|
<div class="header">
|
|
|
|
<slot name="header"></slot>
|
|
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
<slot name="text"></slot>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
2021-01-17 13:04:49 +01:00
|
|
|
<button @click="$emit('close')" class="button is-text has-text-danger is-inverted noshadow underline-none">Cancel</button>
|
|
|
|
<button @click="$emit('submit')" class="button is-primary noshadow">Do it!</button>
|
2018-09-12 08:22:17 +02:00
|
|
|
</div>
|
2021-01-16 22:15:48 +01:00
|
|
|
</slot>
|
2018-09-12 08:22:17 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-05 22:35:52 +02:00
|
|
|
export default {
|
|
|
|
name: 'modal',
|
|
|
|
mounted: function () {
|
|
|
|
document.addEventListener('keydown', (e) => {
|
|
|
|
// Close the model when escape is pressed
|
|
|
|
if (e.keyCode === 27) {
|
|
|
|
this.$emit('close')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
2018-09-12 08:22:17 +02:00
|
|
|
</script>
|