2019-02-05 07:31:40 +00:00
|
|
|
<template lang="html">
|
|
|
|
<div>
|
|
|
|
<div @click="open">
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
|
2019-10-09 19:51:34 +00:00
|
|
|
<div :class="['overlay', { show }]" @click="close">
|
2019-07-11 20:17:32 +00:00
|
|
|
<div
|
2019-10-09 16:30:07 +00:00
|
|
|
:class="['modal-content', { large, confirm, padded }]"
|
2019-07-11 20:17:32 +00:00
|
|
|
@click.stop
|
|
|
|
>
|
2019-09-25 21:56:38 +00:00
|
|
|
<header :class="{ fixed: !title }">
|
|
|
|
<h2 v-if="title">{{ title }}</h2>
|
2019-03-28 21:23:09 +00:00
|
|
|
|
2019-09-25 21:56:38 +00:00
|
|
|
<button :class="closeButtonClass" @click="close">
|
|
|
|
<i class="fas fa-times" />
|
|
|
|
</button>
|
2019-02-15 21:57:11 +00:00
|
|
|
</header>
|
2019-02-18 12:48:26 +00:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<p v-if="message">{{ message }}</p>
|
|
|
|
|
|
|
|
<slot name="content" v-if="show" />
|
|
|
|
|
|
|
|
<div :class="{ actions: actionText }">
|
|
|
|
<button class="small info" @click="close" v-if="showClose">
|
|
|
|
{{ closeText }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
v-if="actionText"
|
2019-05-08 22:34:57 +00:00
|
|
|
class="small primary"
|
2019-02-18 12:48:26 +00:00
|
|
|
:disabled="actionDisabled"
|
|
|
|
@click="handleAction"
|
|
|
|
>
|
|
|
|
{{ actionText }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</section>
|
2019-02-05 07:31:40 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-10-09 16:30:07 +00:00
|
|
|
import { mapState } from 'vuex';
|
2019-02-22 06:14:11 +00:00
|
|
|
|
2019-02-05 07:31:40 +00:00
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
actionText: String,
|
|
|
|
title: String,
|
|
|
|
message: String,
|
|
|
|
showClose: {
|
|
|
|
type: Boolean,
|
2019-02-21 17:03:43 +00:00
|
|
|
default: false,
|
2019-02-05 07:31:40 +00:00
|
|
|
},
|
|
|
|
closeText: {
|
|
|
|
type: String,
|
|
|
|
default: 'Cancel',
|
|
|
|
},
|
|
|
|
actionDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2019-02-06 06:55:00 +00:00
|
|
|
large: Boolean,
|
2019-07-11 20:16:04 +00:00
|
|
|
confirm: Boolean,
|
2019-02-15 21:57:11 +00:00
|
|
|
padded: Boolean,
|
2019-02-05 07:31:40 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
show: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2019-02-22 06:14:11 +00:00
|
|
|
computed: {
|
2019-07-11 23:32:03 +00:00
|
|
|
...mapState(['galleryOpen']),
|
2019-07-11 23:12:09 +00:00
|
|
|
|
2019-08-09 19:03:27 +00:00
|
|
|
routeName() {
|
|
|
|
return this.$route.name;
|
|
|
|
},
|
|
|
|
|
2019-07-11 23:12:09 +00:00
|
|
|
closeButtonClass() {
|
|
|
|
return [
|
2019-10-09 16:30:07 +00:00
|
|
|
{ fixed: !this.title },
|
2019-07-11 23:12:09 +00:00
|
|
|
'small',
|
2019-10-09 16:30:07 +00:00
|
|
|
'secondary',
|
2019-07-11 23:12:09 +00:00
|
|
|
'close-button',
|
|
|
|
];
|
|
|
|
},
|
2019-02-22 06:14:11 +00:00
|
|
|
},
|
|
|
|
|
2019-08-09 19:17:43 +00:00
|
|
|
watch: {
|
|
|
|
routeName() {
|
|
|
|
this.close();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-02-05 07:31:40 +00:00
|
|
|
methods: {
|
|
|
|
open() {
|
|
|
|
this.show = true;
|
|
|
|
this.$emit('open');
|
|
|
|
},
|
|
|
|
|
|
|
|
handleAction() {
|
|
|
|
this.$emit('action');
|
|
|
|
this.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
close() {
|
|
|
|
this.$emit('close');
|
|
|
|
this.show = false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
2019-09-10 20:02:16 +00:00
|
|
|
@import "~styles/styles";
|
2019-02-05 07:31:40 +00:00
|
|
|
|
2019-10-09 19:51:34 +00:00
|
|
|
.overlay {
|
2019-10-09 16:30:07 +00:00
|
|
|
background: rgba(0, 0, 0, 0.6);
|
2019-07-10 23:24:04 +00:00
|
|
|
cursor: pointer;
|
|
|
|
height: 100%;
|
|
|
|
left: 0;
|
|
|
|
margin: 0;
|
2019-02-05 07:31:40 +00:00
|
|
|
opacity: .1;
|
2019-07-10 23:24:04 +00:00
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
2019-02-05 07:31:40 +00:00
|
|
|
transition: all 100ms linear;
|
|
|
|
visibility: hidden;
|
2019-07-10 23:24:04 +00:00
|
|
|
width: 100%;
|
|
|
|
z-index: 1;
|
2019-03-28 21:23:09 +00:00
|
|
|
|
2019-02-05 07:31:40 +00:00
|
|
|
&.show {
|
|
|
|
visibility: visible;
|
|
|
|
transition: all 100ms linear;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
2019-07-10 23:24:04 +00:00
|
|
|
}
|
2019-02-05 07:31:40 +00:00
|
|
|
|
2019-07-10 23:24:04 +00:00
|
|
|
.modal-content {
|
|
|
|
position: relative;
|
2019-10-09 16:30:07 +00:00
|
|
|
background: var(--modal-background);
|
|
|
|
color: var(--modal-text-color);
|
2019-07-10 23:24:04 +00:00
|
|
|
height: auto;
|
2019-10-01 22:25:49 +00:00
|
|
|
width: 500px;
|
2019-07-10 23:24:04 +00:00
|
|
|
max-height: calc(85vh);
|
|
|
|
max-width: 100%;
|
|
|
|
overflow: auto;
|
2019-10-01 22:25:49 +00:00
|
|
|
margin: $gp * 2 auto $gp;
|
2019-07-10 23:24:04 +00:00
|
|
|
padding: 0;
|
|
|
|
border-radius: $border-radius;
|
|
|
|
cursor: default;
|
2019-02-06 06:55:00 +00:00
|
|
|
|
2019-07-10 23:24:04 +00:00
|
|
|
&.large {
|
|
|
|
width: 780px;
|
|
|
|
max-width: 100% !important;
|
2019-02-16 04:45:14 +00:00
|
|
|
|
2019-07-10 23:24:04 +00:00
|
|
|
@media($small) {
|
|
|
|
max-width: 90vw;
|
|
|
|
max-height: 100vh;
|
2019-02-16 04:45:14 +00:00
|
|
|
}
|
2019-07-10 23:24:04 +00:00
|
|
|
}
|
2019-02-08 06:14:02 +00:00
|
|
|
|
2019-07-10 23:24:04 +00:00
|
|
|
&.padded {
|
|
|
|
> section {
|
|
|
|
padding: 0 $gp $gp;
|
2019-02-22 06:14:11 +00:00
|
|
|
}
|
2019-02-08 06:14:02 +00:00
|
|
|
}
|
2019-02-06 06:55:00 +00:00
|
|
|
|
2019-07-11 20:16:04 +00:00
|
|
|
&.confirm {
|
|
|
|
@media($small) {
|
|
|
|
height: auto;
|
|
|
|
border-radius: $border-radius;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-10 23:24:04 +00:00
|
|
|
@media($small) {
|
|
|
|
border-radius: 0;
|
|
|
|
margin: 0;
|
|
|
|
height: auto;
|
|
|
|
max-height: 100vh;
|
|
|
|
height: 100vh;
|
2019-10-01 22:25:49 +00:00
|
|
|
width: 100vw;
|
2019-02-06 06:55:00 +00:00
|
|
|
}
|
2019-02-05 07:31:40 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 21:57:11 +00:00
|
|
|
header {
|
2019-02-15 22:19:37 +00:00
|
|
|
display: flex;
|
2019-02-18 12:48:26 +00:00
|
|
|
top: 0;
|
2019-07-11 19:05:59 +00:00
|
|
|
padding: $gp / 2 $gp;
|
2019-07-11 20:16:04 +00:00
|
|
|
z-index: 1;
|
2019-02-18 12:48:26 +00:00
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
min-height: 30px;
|
2019-07-11 20:16:04 +00:00
|
|
|
|
|
|
|
@media($small) {
|
2019-09-25 22:36:31 +00:00
|
|
|
padding: $gp * 2 $gp $gp;
|
2019-09-25 21:56:38 +00:00
|
|
|
right: 0;
|
2019-09-25 22:36:31 +00:00
|
|
|
margin-top: $gp;
|
2019-09-25 21:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&.fixed {
|
|
|
|
position: fixed;
|
2019-09-25 22:36:31 +00:00
|
|
|
padding: $gp;
|
2019-09-25 21:56:38 +00:00
|
|
|
background-color: transparent !important;
|
2019-09-25 22:36:31 +00:00
|
|
|
margin: 0;
|
|
|
|
z-index: 99999999;
|
2019-07-11 20:16:04 +00:00
|
|
|
}
|
2019-02-18 12:48:26 +00:00
|
|
|
}
|
2019-02-15 22:19:37 +00:00
|
|
|
|
2019-07-10 23:24:04 +00:00
|
|
|
.close-button {
|
2019-02-21 03:09:45 +00:00
|
|
|
display: none;
|
|
|
|
|
|
|
|
@media($small) {
|
2019-07-11 20:27:20 +00:00
|
|
|
display: block;
|
2019-02-21 03:09:45 +00:00
|
|
|
}
|
2019-02-15 22:19:37 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 07:31:40 +00:00
|
|
|
.actions {
|
|
|
|
display: grid;
|
|
|
|
grid-gap: $gp;
|
|
|
|
grid-template-columns: auto auto;
|
|
|
|
}
|
|
|
|
</style>
|