-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModalDialog.vue
91 lines (79 loc) · 1.51 KB
/
ModalDialog.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<script>
export default {
methods: {
onEsc(event) {
if (event.keyCode === 27) {
this.$emit('close');
}
},
},
mounted() {
document.addEventListener('keydown', this.onEsc);
},
beforeDestroy() {
document.removeEventListener('keydown', this.onEsc);
},
};
</script>
<template>
<div class="modal is-active" transition="modal">
<div class="modal-background" @click="$emit('close')"></div>
<div class="modal-content">
<slot></slot>
</div>
<slot name="extend"></slot>
<button class="modal-close is-large" @click="$emit('close')"></button>
</div>
</template>
<style lang="scss">
.modal {
button {
text-transform: uppercase;
}
.modal-content {
text-align: left;
white-space: normal;
&.capped {
padding-top: $size-normal;
}
}
&__caption {
margin-bottom: $size-small;
font-size: $size-medium;
font-weight: bold;
}
.body-spacer {
margin-bottom: $size-normal;
}
&__section {
margin: 0 0 $size-normal;
}
&__body {
font-size: 1em;
margin: $size-normal 0;
margin-top: 0;
.wide-content {
margin: 0 - $size-medium $size-normal;
}
}
&__centred {
text-align: center;
}
&__options {
.material-icons {
vertical-align: middle;
position: relative;
top: -1px;
font-size: 20px;
}
}
}
.modal-enter,
.modal-leave {
opacity: 0;
}
.modal-enter .modal-dialog__container,
.modal-leave .modal-dialog__container {
transform: scale(1.1);
}
</style>