Files
solidtime/resources/js/packages/ui/src/Modal.vue
2026-03-23 17:43:46 +01:00

52 lines
1.0 KiB
Vue

<script setup lang="ts">
import { Dialog, DialogContent, DialogFooter } from './dialog/index';
import { computed } from 'vue';
const props = defineProps({
show: {
type: Boolean,
default: false,
},
maxWidth: {
type: String,
default: '2xl',
},
closeable: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['close']);
const close = () => {
if (props.closeable) {
emit('close');
}
};
const maxWidthClass = computed(() => {
return {
sm: 'sm:max-w-sm',
md: 'sm:max-w-md',
lg: 'sm:max-w-lg',
xl: 'sm:max-w-xl',
'2xl': 'sm:max-w-2xl',
}[props.maxWidth];
});
</script>
<template>
<Dialog :open="show" @update:open="close">
<DialogContent :class="maxWidthClass">
<div class="min-w-0">
<slot />
</div>
<DialogFooter>
<slot name="footer" />
</DialogFooter>
</DialogContent>
</Dialog>
</template>