parsley/app/javascript/components/AppModal.vue

65 lines
1.2 KiB
Vue
Raw Normal View History

2018-03-30 17:08:09 -05:00
<template>
<Teleport to="body">
<div :class="['popup', 'modal', { 'is-wide': wide, 'is-active': open && error === null }]">
2018-03-30 17:08:09 -05:00
<div class="modal-background" @click="close"></div>
<div class="modal-card">
<header class="modal-card-head">
<slot name="title">
<p class="modal-card-title">{{ title }}</p>
2018-09-06 18:16:13 -05:00
<app-icon class="close-button" icon="x" aria-label="close" @click="close"></app-icon>
2018-03-30 17:08:09 -05:00
</slot>
</header>
<section class="modal-card-body">
<slot></slot>
</section>
</div>
</div>
</Teleport>
2018-03-30 17:08:09 -05:00
</template>
<script>
import { mapState } from "pinia";
import { useAppConfigStore } from "../stores/appConfig";
2018-03-30 17:08:09 -05:00
export default {
emits: ["dismiss"],
2018-03-30 17:08:09 -05:00
props: {
open: {
type: Boolean,
default: false
},
2018-05-01 10:55:57 -05:00
title: String,
wide: {
type: Boolean,
default: false
}
2018-03-30 17:08:09 -05:00
},
2018-04-01 12:17:54 -05:00
computed: {
...mapState(useAppConfigStore, [
2018-04-01 12:17:54 -05:00
'error'
])
},
2018-03-30 17:08:09 -05:00
methods: {
close() {
this.$emit("dismiss");
}
},
components: {
}
}
</script>
<style lang="scss" scoped>
2018-09-06 18:16:13 -05:00
.close-button {
cursor: pointer;
}
2018-03-30 17:08:09 -05:00
</style>