|
| 1 | +<template> |
| 2 | + <div |
| 3 | + v-if="isOpen" |
| 4 | + class="fixed inset-0 bg-black bg-opacity-15 flex justify-center items-center z-50" |
| 5 | + @click.self="closeModal"> |
| 6 | + <div class="bg-white rounded-lg shadow-lg px-8 py-8 min-w-[364px]"> |
| 7 | + <div class="mb-2 min-h-16"> |
| 8 | + <div |
| 9 | + v-if="type == 'successType'" |
| 10 | + class="flex ic justify-center"> |
| 11 | + <CommonIcons :name="successIcon" /> |
| 12 | + </div> |
| 13 | + <div |
| 14 | + v-if="type == 'failType' || type == 'inputType'" |
| 15 | + class="flex ic justify-center"> |
| 16 | + <CommonIcons :name="failIcon" /> |
| 17 | + </div> |
| 18 | + <div |
| 19 | + v-if="type == 'warningType'" |
| 20 | + class="flex ic justify-center"> |
| 21 | + <CommonIcons :name="warningIcon" /> |
| 22 | + </div> |
| 23 | + </div> |
| 24 | + |
| 25 | + <div> |
| 26 | + <div class="flex text-2xl font-bold justify-center mb-2"> |
| 27 | + <slot name="header"></slot> |
| 28 | + </div> |
| 29 | + <div |
| 30 | + v-if="type != 'inputType'" |
| 31 | + class="flex text-sm font-bold text-body justify-center"> |
| 32 | + <slot name="body"></slot> |
| 33 | + </div> |
| 34 | + </div> |
| 35 | + |
| 36 | + <textarea |
| 37 | + v-if="type == 'inputType'" |
| 38 | + v-model="textValue" |
| 39 | + placeholder="거부 사유를 입력해주세요" |
| 40 | + class="flex border w-full border-zinc-300 px-4 py-3 focus:outline-none resize-none mt-6 h-[120px]" /> |
| 41 | + <div class="mt-8"> |
| 42 | + <button |
| 43 | + class="button-large-primary" |
| 44 | + v-if="type == 'successType'" |
| 45 | + @click="closeModal"> |
| 46 | + 확인 |
| 47 | + </button> |
| 48 | + |
| 49 | + <button |
| 50 | + class="button-large-default" |
| 51 | + v-if="type == 'failType'" |
| 52 | + @click="closeModal"> |
| 53 | + 확인 |
| 54 | + </button> |
| 55 | + |
| 56 | + <div |
| 57 | + class="flex mt-8 items-center" |
| 58 | + v-if="type == 'warningType' || type == 'inputType'"> |
| 59 | + <div class="mr-6"> |
| 60 | + <button |
| 61 | + class="button-large-default" |
| 62 | + @click="closeModal"> |
| 63 | + 취소 |
| 64 | + </button> |
| 65 | + </div> |
| 66 | + <div> |
| 67 | + <button |
| 68 | + class="button-large-red" |
| 69 | + @click="closeModal"> |
| 70 | + {{ type === 'inputType' ? '거부' : '삭제' }} |
| 71 | + </button> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | +</template> |
| 78 | + |
| 79 | +<script setup lang="ts"> |
| 80 | +import { ref, watch } from 'vue' |
| 81 | +import CommonIcons from './common/CommonIcons.vue' |
| 82 | +import { successIcon, failIcon, warningIcon } from '../constants/iconPath' |
| 83 | +
|
| 84 | +const props = defineProps<{ |
| 85 | + isOpen: boolean |
| 86 | + type?: string |
| 87 | + modelValue?: string |
| 88 | +}>() |
| 89 | +
|
| 90 | +const emit = defineEmits<{ |
| 91 | + (e: 'close'): void |
| 92 | + (e: 'click'): void |
| 93 | + (e: 'update:modelValue', value: string): void |
| 94 | +}>() |
| 95 | +
|
| 96 | +const textValue = ref(props.modelValue || '') |
| 97 | +
|
| 98 | +watch(textValue, newValue => { |
| 99 | + emit('update:modelValue', newValue) |
| 100 | +}) |
| 101 | +
|
| 102 | +const closeModal = () => { |
| 103 | + emit('close') |
| 104 | +} |
| 105 | +</script> |
0 commit comments