| 1 |
<template> |
| 2 |
<transition name="modal-fade"> |
| 3 |
<div class="modal-backdrop"> |
| 4 |
<div class="modal" |
| 5 |
role="dialog" |
| 6 |
:aria-labelledby="$id('modalTitle')" |
| 7 |
:aria-describedby="$id('modalDescription')" |
| 8 |
> |
| 9 |
<header class="modal-header" :id="$id('modalTitle')"> |
| 10 |
<slot name="header"></slot> |
| 11 |
</header> |
| 12 |
<section class="modal-body" :id="$id('modalDescription')"> |
| 13 |
<slot name="body"></slot> |
| 14 |
</section> |
| 15 |
|
| 16 |
<footer class="modal-footer"> |
| 17 |
<slot name="footer"> |
| 18 |
<button type="button" |
| 19 |
class="button button-success" |
| 20 |
@click="close" |
| 21 |
v-text="booter.trans.close" |
| 22 |
></button> |
| 23 |
</slot> |
| 24 |
</footer> |
| 25 |
</div> |
| 26 |
</div> |
| 27 |
</transition> |
| 28 |
</template> |
| 29 |
|
| 30 |
<style> |
| 31 |
.modal-fade-enter.modal-backdrop, |
| 32 |
.modal-fade-leave-active.modal-backdrop { |
| 33 |
opacity: 0; |
| 34 |
} |
| 35 |
.modal-fade-enter .modal, |
| 36 |
.modal-fade-leave-active .modal { |
| 37 |
opacity: 0; |
| 38 |
transform: translateY(100px) scale(0.9); |
| 39 |
} |
| 40 |
|
| 41 |
.modal-fade-enter-active.modal-backdrop, |
| 42 |
.modal-fade-leave-active.modal-backdrop, |
| 43 |
.modal-fade-enter-active .modal, |
| 44 |
.modal-fade-leave-active .modal { |
| 45 |
transition: opacity .3s ease, |
| 46 |
transform .1s ease; |
| 47 |
} |
| 48 |
|
| 49 |
@media (prefers-reduced-motion: reduce) { |
| 50 |
.modal-fade-enter-active.modal-backdrop, |
| 51 |
.modal-fade-leave-active.modal-backdrop, |
| 52 |
.modal-fade-enter-active .modal, |
| 53 |
.modal-fade-leave-active .modal { |
| 54 |
transition: none; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
.modal-backdrop { |
| 59 |
position: fixed; |
| 60 |
top: 0; |
| 61 |
bottom: 0; |
| 62 |
left: 0; |
| 63 |
right: 0; |
| 64 |
background-color: rgba(0, 0, 0, 0.3); |
| 65 |
display: flex; |
| 66 |
justify-content: center; |
| 67 |
align-items: center; |
| 68 |
z-index: 1040; |
| 69 |
} |
| 70 |
|
| 71 |
.modal { |
| 72 |
background: #FFFFFF; |
| 73 |
box-shadow: 2px 2px 20px 1px; |
| 74 |
overflow-x: auto; |
| 75 |
display: flex; |
| 76 |
flex-direction: column; |
| 77 |
min-width: 480px; |
| 78 |
max-width: 80%; |
| 79 |
max-width: 80vw; |
| 80 |
z-index: 1050; |
| 81 |
} |
| 82 |
|
| 83 |
.modal-header, |
| 84 |
.modal-footer { |
| 85 |
padding: 15px; |
| 86 |
display: flex; |
| 87 |
} |
| 88 |
|
| 89 |
.modal-header { |
| 90 |
border-bottom: 1px solid #eeeeee; |
| 91 |
justify-content: space-between; |
| 92 |
} |
| 93 |
|
| 94 |
.modal-footer { |
| 95 |
border-top: 1px solid #eeeeee; |
| 96 |
justify-content: flex-end; |
| 97 |
} |
| 98 |
|
| 99 |
.modal-body { |
| 100 |
position: relative; |
| 101 |
padding: 20px 10px; |
| 102 |
max-height: 60%; |
| 103 |
max-height: 60vh; |
| 104 |
overflow: auto; |
| 105 |
} |
| 106 |
|
| 107 |
.btn-close { |
| 108 |
border: none; |
| 109 |
font-size: 20px; |
| 110 |
padding: 20px; |
| 111 |
cursor: pointer; |
| 112 |
font-weight: bold; |
| 113 |
color: #4AAE9B; |
| 114 |
background: transparent; |
| 115 |
} |
| 116 |
</style> |
| 117 |
|
| 118 |
<script> |
| 119 |
export default { |
| 120 |
name: 'modal', |
| 121 |
methods: { |
| 122 |
close() { |
| 123 |
this.$emit('close'); |
| 124 |
}, |
| 125 |
}, |
| 126 |
}; |
| 127 |
</script> |
| 128 |
|