-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModalDialog.vue
More file actions
95 lines (84 loc) · 2.03 KB
/
ModalDialog.vue
File metadata and controls
95 lines (84 loc) · 2.03 KB
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
92
93
94
95
<template>
<ModalContainer
v-model="showDialog"
>
<div class="dialog">
<div class="dialog__content">
<slot />
</div>
<FlatButton
icon="xmark"
class="dialog__close-button"
@click="hide"
/>
</div>
</ModalContainer>
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue';
import FlatButton from '@/presentation/components/Shared/FlatButton.vue';
import ModalContainer from './ModalContainer.vue';
export default defineComponent({
components: {
ModalContainer,
FlatButton,
},
props: {
modelValue: {
type: Boolean,
required: true,
},
},
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars */
'update:modelValue': (isOpen: boolean) => true,
/* eslint-enable @typescript-eslint/no-unused-vars */
},
setup(props, { emit }) {
const showDialog = computed({
get: () => props.modelValue,
set: (value) => {
if (value !== props.modelValue) {
emit('update:modelValue', value);
}
},
});
function hide() {
showDialog.value = false;
}
return {
showDialog,
hide,
};
},
});
</script>
<style scoped lang="scss">
@use "@/presentation/assets/styles/main" as *;
.dialog {
margin-bottom: $spacing-absolute-medium;
display: flex;
flex-direction: row;
&__content {
margin: $spacing-absolute-xx-large;
@media screen and (max-width: $media-screen-big-width) {
margin: $spacing-absolute-x-large;
}
@media screen and (max-width: $media-screen-medium-width) {
margin: $spacing-absolute-large;
}
}
.dialog__close-button {
color: $color-primary-dark;
width: auto;
font-size: $font-size-absolute-large;
margin-right: $spacing-absolute-small;
@mixin keep-visible-above-scrollbar { // Prevents close button from being obscured by scrollbar on small screens.
position: absolute;
top: 0;
right: 0; // Aligns right
}
@include keep-visible-above-scrollbar;
}
}
</style>