parsley/app/javascript/components/AppModal.vue

60 lines
1.2 KiB
Vue
Raw Normal View History

2018-03-30 17:08:09 -05:00
<template>
<Teleport to="body">
2024-10-02 14:34:50 -05:00
<div :class="['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>
2024-10-02 14:34:50 -05:00
<footer class="modal-card-foot">
<slot name="footer">
</slot>
</footer>
2018-03-30 17:08:09 -05:00
</div>
</div>
</Teleport>
2018-03-30 17:08:09 -05:00
</template>
2024-09-29 13:35:49 -05:00
<script setup>
2018-03-30 17:08:09 -05:00
2024-09-29 13:35:49 -05:00
import { computed } from "vue";
import { useAppConfigStore } from "../stores/appConfig";
2018-03-30 17:08:09 -05:00
2024-09-29 13:35:49 -05:00
const emit = defineEmits(["dismiss"]);
2024-09-29 13:35:49 -05:00
const props = defineProps({
open: {
type: Boolean,
default: false
2018-03-30 17:08:09 -05:00
},
2024-09-29 13:35:49 -05:00
title: String,
wide: {
type: Boolean,
default: false
}
});
2018-03-30 17:08:09 -05:00
2024-09-29 13:35:49 -05:00
const appConfig = useAppConfigStore();
const error = computed(() => appConfig.error);
2018-04-01 12:17:54 -05:00
2024-09-29 13:35:49 -05:00
function close() {
emit("dismiss");
2018-03-30 17:08:09 -05:00
}
</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>