|
6 | 6 |
|
7 | 7 | <div class="fixed inset-0 z-10 overflow-y-auto"> |
8 | 8 | <div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> |
9 | | - <div :class="[modalClass, sizeClass, transition2]" |
10 | | - @mousedown.stop=""> |
| 9 | + <div :class="[modalClass, sizeClass, transition2]" @mousedown.stop=""> |
11 | 10 | <div> |
12 | | - <div class="hidden sm:block absolute top-0 right-0 pt-4 pr-4 z-10"> |
13 | | - <button type="button" @click="close" |
14 | | - class="bg-white dark:bg-black rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:ring-offset-black"> |
| 11 | + <slot v-if="slots.closebutton" name="createform"></slot> |
| 12 | + <div v-else class="hidden sm:block absolute top-0 right-0 pt-4 pr-4 z-10"> |
| 13 | + <button type="button" @click="close":class="closeButtonClass"> |
15 | 14 | <span class="sr-only">Close</span> |
16 | 15 | <!-- Heroicon name: outline/x --> |
17 | 16 | <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" |
|
24 | 23 | <slot></slot> |
25 | 24 | </div> |
26 | 25 | </div> |
| 26 | + <slot name="bottom"></slot> |
27 | 27 | </div> |
28 | 28 | </div> |
29 | 29 |
|
|
33 | 33 |
|
34 | 34 | <script setup lang="ts"> |
35 | 35 | import type { ModalProvider } from "@/types" |
36 | | -import { onMounted, onUnmounted, watch, ref, provide } from "vue" |
| 36 | +import { onMounted, onUnmounted, watch, ref, provide, useSlots } from "vue" |
37 | 37 | import { transition } from '@/use/utils' |
38 | 38 | import * as css from "./css" |
39 | 39 |
|
| 40 | +const slots = useSlots() |
| 41 | +
|
40 | 42 | const props = withDefaults(defineProps<{ |
41 | 43 | id?: string |
42 | 44 | modalClass?: string |
43 | 45 | sizeClass?: string |
| 46 | + closeButtonClass?: string |
44 | 47 | }>(), { |
45 | 48 | id: 'ModalDialog', |
46 | 49 | modalClass: css.modal.modalClass, |
47 | 50 | sizeClass: css.modal.sizeClass, |
| 51 | + closeButtonClass: "bg-white dark:bg-black rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:ring-offset-black", |
48 | 52 | }) |
49 | 53 |
|
50 | 54 | const emit = defineEmits<{ |
|
0 commit comments