|
1 | 1 | <script setup lang="ts"> |
| 2 | +import { ref, useTemplateRef, watch } from 'vue'; |
2 | 3 | import { OnClickOutside } from '@vueuse/components'; |
3 | 4 | import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component'; |
4 | 5 | import { useAppStore } from '@/stores/AppStore'; |
5 | | -import { ref, useTemplateRef, watch } from 'vue'; |
6 | 6 |
|
7 | 7 | import ButtonCorner from '@/components/inputs/ButtonCorner.vue'; |
| 8 | +import ButtonForm from '@/components/inputs/ButtonForm.vue'; |
8 | 9 |
|
9 | 10 | const props = withDefaults( |
10 | 11 | defineProps<{ |
@@ -70,39 +71,24 @@ watch( |
70 | 71 | <OnClickOutside |
71 | 72 | @trigger="modalData.toggleModal(false)" |
72 | 73 | @keydown.esc="modalData.toggleModal(false)" |
73 | | - class="drop-shadow-md m-auto w-full p-6 bg-white dark:bg-neutral-800/90 backdrop-blur-lg border shadow-lg border-neutral-200 dark:border-neutral-700 sm:max-w-lg xl:max-w-xl 3xl:max-w-2xl rounded-md sm:rounded-lg" |
| 74 | + class="gap-4 flex flex-col drop-shadow-md m-auto w-full p-6 bg-white dark:bg-neutral-800/90 backdrop-blur-lg border shadow-lg border-neutral-200 dark:border-neutral-700 sm:max-w-lg xl:max-w-xl 3xl:max-w-2xl rounded-md sm:rounded-lg" |
74 | 75 | tabindex="-1" |
75 | 76 | > |
76 | | - <div class="flex items-center justify-between pb-3"> |
77 | | - <h3 ref="modalTitle" class="text-xl font-semibold scroll-mt-16 sm:scroll-mt-12 me-8">{{ modalData?.title ?? 'Modal Title' }}</h3> |
78 | | - <ButtonCorner @click="modalData.toggleModal(false)" /> |
79 | | - </div> |
80 | | - <slot name="content"> |
81 | | - <div class="relative w-auto pb-8"> |
82 | | - <p>This is placeholder text. Replace it with your own content.</p> |
83 | | - </div> |
84 | | - </slot> |
| 77 | + <section class="flex flex-wrap gap-2 items-center"> |
| 78 | + <h3 ref="modalTitle" class="text-xl font-semibold scroll-mt-16 sm:scroll-mt-12 flex-1">{{ modalData?.title ?? 'Modal Title' }}</h3> |
| 79 | + <ButtonCorner @click="modalData.toggleModal(false)" class="!m-0 !static" /> |
| 80 | + <p class="text-neutral-500 dark:text-neutral-400 text-sm w-full" v-if="$slots.description"> |
| 81 | + <slot name="description"> </slot> |
| 82 | + </p> |
| 83 | + </section> |
| 84 | + <slot name="content"> </slot> |
85 | 85 | <slot v-if="useControls" name="controls"> |
86 | | - <div class="relative flex flex-col-reverse sm:flex-row sm:justify-end gap-2"> |
87 | | - <button |
88 | | - @click="modalData.toggleModal(false)" |
89 | | - type="button" |
90 | | - class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border dark:border-neutral-600 rounded-md focus:outline-none" |
91 | | - :class="'focus:ring-1 focus:ring-neutral-100 dark:focus:ring-neutral-400 focus:ring-offset-1 hover:bg-neutral-100 dark:hover:bg-neutral-900'" |
92 | | - :disabled="processing || isProcessing" |
93 | | - > |
94 | | - Cancel |
95 | | - </button> |
96 | | - <button |
97 | | - @click="submitModal(action, modalData)" |
98 | | - type="button" |
99 | | - class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium text-white transition-colors border border-transparent rounded-md focus:outline-none" |
100 | | - :class="'focus:ring-1 focus:ring-violet-900 focus:ring-offset-1 bg-neutral-950 hover:bg-neutral-800 dark:hover:bg-neutral-900 '" |
101 | | - :disabled="processing || isProcessing" |
102 | | - > |
| 86 | + <section class="relative flex flex-col-reverse sm:flex-row sm:justify-end gap-2"> |
| 87 | + <ButtonForm type="button" variant="reset" @click="modalData.toggleModal(false)" :disabled="processing || isProcessing"> Cancel </ButtonForm> |
| 88 | + <ButtonForm type="button" variant="submit" @click="submitModal(action, modalData)" :disabled="processing || isProcessing"> |
103 | 89 | {{ modalData.submitText }} |
104 | | - </button> |
105 | | - </div> |
| 90 | + </ButtonForm> |
| 91 | + </section> |
106 | 92 | </slot> |
107 | 93 | </OnClickOutside> |
108 | 94 | </UseFocusTrap> |
|
0 commit comments