2019-02-05 07:31:40 +00:00
|
|
|
<template lang="html">
|
2019-11-08 20:34:06 +00:00
|
|
|
<div>
|
|
|
|
<div @click="open">
|
|
|
|
<slot />
|
2019-02-05 07:31:40 +00:00
|
|
|
</div>
|
2019-11-08 20:34:06 +00:00
|
|
|
|
2019-11-14 21:10:10 +00:00
|
|
|
<div :class="['overlay', { show }]" @click="close">
|
|
|
|
<div :class="['modal-content', { large, fixed: !title }]" @click.stop>
|
2019-11-08 20:34:06 +00:00
|
|
|
<header>
|
|
|
|
<h2 v-if="title">{{ title }}</h2>
|
|
|
|
|
2019-11-14 21:10:10 +00:00
|
|
|
<button class="secondary small" @click="close">
|
2019-11-08 20:34:06 +00:00
|
|
|
<i class="fas fa-times" />
|
|
|
|
</button>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<main>
|
|
|
|
<span v-if="message">{{ message }}</span>
|
2019-11-20 01:50:25 +00:00
|
|
|
<slot v-if="show" name="content" />
|
2019-11-08 20:34:06 +00:00
|
|
|
|
|
|
|
<footer v-if="actionText">
|
|
|
|
<button
|
|
|
|
:class="actionButtonClass"
|
|
|
|
:disabled="actionDisabled"
|
|
|
|
@click="handleAction"
|
|
|
|
>
|
|
|
|
{{ actionText }}
|
|
|
|
</button>
|
|
|
|
</footer>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-02-05 07:31:40 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2019-11-08 19:56:03 +00:00
|
|
|
props: {
|
2019-11-08 20:34:06 +00:00
|
|
|
actionText: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
actionButtonClass: {
|
|
|
|
type: String,
|
|
|
|
default: 'primary',
|
2019-02-05 07:31:40 +00:00
|
|
|
},
|
2019-11-08 20:34:06 +00:00
|
|
|
actionDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
large: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2019-02-05 07:31:40 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
show: false,
|
|
|
|
};
|
|
|
|
},
|
2019-02-05 07:31:40 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
computed: {
|
|
|
|
routeName() {
|
|
|
|
return this.$route.name;
|
2019-02-22 06:14:11 +00:00
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2019-02-22 06:14:11 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
watch: {
|
|
|
|
routeName() {
|
|
|
|
this.close();
|
2019-08-09 19:17:43 +00:00
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2019-08-09 19:17:43 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
methods: {
|
|
|
|
open() {
|
|
|
|
this.show = true;
|
|
|
|
this.$emit('open');
|
|
|
|
},
|
2019-02-05 07:31:40 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
handleAction() {
|
|
|
|
this.$emit('action');
|
|
|
|
this.close();
|
|
|
|
},
|
2019-02-05 07:31:40 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
close() {
|
|
|
|
this.$emit('close');
|
|
|
|
this.show = false;
|
2019-02-05 07:31:40 +00:00
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2019-02-05 07:31:40 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
2019-11-08 20:34:06 +00:00
|
|
|
@import "~styles/styles";
|
|
|
|
|
|
|
|
.overlay {
|
|
|
|
background: rgba(0, 0, 0, 0.8);
|
|
|
|
cursor: pointer;
|
|
|
|
height: 100%;
|
|
|
|
left: 0;
|
|
|
|
margin: 0;
|
|
|
|
opacity: .1;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
transition: all 100ms linear;
|
|
|
|
visibility: hidden;
|
|
|
|
width: 100%;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
&.show {
|
|
|
|
visibility: visible;
|
|
|
|
transition: all 100ms linear;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-content {
|
|
|
|
background: var(--modal-background);
|
|
|
|
color: var(--modal-text-color);
|
|
|
|
width: 500px;
|
|
|
|
height: auto;
|
|
|
|
max-height: calc(100% - #{$gp * 4});
|
|
|
|
overflow-y: auto;
|
|
|
|
margin: $gp * 2 auto $gp;
|
|
|
|
padding: 0;
|
|
|
|
border-radius: $border-radius;
|
|
|
|
cursor: default;
|
|
|
|
|
|
|
|
@media($small) {
|
|
|
|
border-radius: 0;
|
|
|
|
margin: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
max-height: 100%;
|
2019-02-05 07:31:40 +00:00
|
|
|
}
|
2019-10-16 19:39:40 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
&.large {
|
|
|
|
width: 780px;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
2019-10-16 19:39:40 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
&.fixed {
|
|
|
|
@media($small) {
|
|
|
|
display: flex;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
2019-02-06 06:55:00 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
header {
|
|
|
|
position: fixed;
|
|
|
|
right: $gp;
|
2019-07-11 20:16:04 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
button {
|
|
|
|
display: none;
|
2019-10-18 04:36:51 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
@media($small) {
|
|
|
|
display: block;
|
|
|
|
}
|
2019-10-16 19:39:40 +00:00
|
|
|
}
|
2019-11-08 20:34:06 +00:00
|
|
|
}
|
2019-09-25 21:56:38 +00:00
|
|
|
}
|
2019-11-08 20:34:06 +00:00
|
|
|
}
|
2019-09-25 21:56:38 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
header {
|
|
|
|
display: flex;
|
|
|
|
padding: $gp;
|
|
|
|
z-index: 1;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
2019-10-16 19:39:40 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
&.fixed {
|
|
|
|
position: fixed;
|
2019-07-11 20:16:04 +00:00
|
|
|
}
|
2019-11-08 20:34:06 +00:00
|
|
|
}
|
2019-02-15 22:19:37 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
main {
|
|
|
|
padding: 0 $gp $gp;
|
|
|
|
overflow-y: auto;
|
|
|
|
}
|
2019-02-15 22:19:37 +00:00
|
|
|
|
2019-11-08 20:34:06 +00:00
|
|
|
footer {
|
|
|
|
margin-top: $gp;
|
|
|
|
}
|
2019-02-05 07:31:40 +00:00
|
|
|
</style>
|