2019-02-05 07:31:40 +00:00
|
|
|
<template lang="html">
|
|
|
|
<div>
|
|
|
|
<div @click="open">
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div :class="['modal', { show }]" @click="close">
|
2019-02-15 21:57:11 +00:00
|
|
|
<i class="close fas fa-times" @click="close" />
|
|
|
|
|
|
|
|
<div :class="['content', { large, padded }]" @click.stop>
|
|
|
|
<header>
|
|
|
|
<h2 v-if="title">{{ title }}</h2>
|
|
|
|
</header>
|
2019-02-05 07:31:40 +00:00
|
|
|
<p v-if="message">{{ message }}</p>
|
|
|
|
|
2019-02-08 06:14:02 +00:00
|
|
|
<slot name="content" v-if="show" />
|
2019-02-05 07:31:40 +00:00
|
|
|
|
|
|
|
<div :class="{ actions: actionText }">
|
|
|
|
<button class="small info" @click="close" v-if="showClose">
|
|
|
|
{{ closeText }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
v-if="actionText"
|
|
|
|
class="small primary action"
|
|
|
|
:disabled="actionDisabled"
|
|
|
|
@click="handleAction"
|
|
|
|
>
|
|
|
|
{{ actionText }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
actionText: String,
|
|
|
|
title: String,
|
|
|
|
message: String,
|
|
|
|
showClose: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
closeText: {
|
|
|
|
type: String,
|
|
|
|
default: 'Cancel',
|
|
|
|
},
|
|
|
|
actionDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2019-02-06 06:55:00 +00:00
|
|
|
large: Boolean,
|
2019-02-15 21:57:11 +00:00
|
|
|
padded: Boolean,
|
2019-02-05 07:31:40 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
show: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
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>
|
|
|
|
@import "~styles/styles.scss";
|
|
|
|
|
|
|
|
.modal {
|
2019-02-08 17:34:05 +00:00
|
|
|
color: $color-dark-gray;
|
2019-02-05 07:31:40 +00:00
|
|
|
width: 100%;
|
|
|
|
position: fixed;
|
2019-02-15 21:57:11 +00:00
|
|
|
background: rgba(0, 0, 0, 0.8);
|
2019-02-05 07:31:40 +00:00
|
|
|
z-index: 1;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
opacity: .1;
|
|
|
|
height: 100%;
|
|
|
|
transition: all 100ms linear;
|
|
|
|
visibility: hidden;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&.show {
|
|
|
|
visibility: visible;
|
|
|
|
transition: all 100ms linear;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
|
|
position: relative;
|
2019-02-15 21:57:11 +00:00
|
|
|
background-color: $color-white;
|
2019-02-05 07:31:40 +00:00
|
|
|
height: auto;
|
2019-02-08 06:14:02 +00:00
|
|
|
width: 320px;
|
2019-02-15 21:57:11 +00:00
|
|
|
max-height: calc(85vh);
|
|
|
|
max-width: 100%;
|
2019-02-06 06:55:00 +00:00
|
|
|
overflow: auto;
|
2019-02-15 21:57:11 +00:00
|
|
|
margin: 0 $gp;
|
|
|
|
padding: 0;
|
2019-02-05 07:31:40 +00:00
|
|
|
border-radius: $border-radius;
|
|
|
|
cursor: default;
|
2019-02-06 06:55:00 +00:00
|
|
|
|
2019-02-15 21:57:11 +00:00
|
|
|
&.large {
|
|
|
|
width: 780px;
|
2019-02-08 06:14:02 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 21:57:11 +00:00
|
|
|
&.padded {
|
|
|
|
padding: $gp;
|
2019-02-08 06:14:02 +00:00
|
|
|
}
|
2019-02-06 06:55:00 +00:00
|
|
|
|
2019-02-08 06:14:02 +00:00
|
|
|
@media($small) {
|
2019-02-08 06:59:05 +00:00
|
|
|
height: auto;
|
2019-02-15 21:57:11 +00:00
|
|
|
margin: 0;
|
2019-02-08 06:14:02 +00:00
|
|
|
max-height: 100vh;
|
2019-02-15 21:57:11 +00:00
|
|
|
height: 100vh;
|
2019-02-08 06:14:02 +00:00
|
|
|
border-radius: 0;
|
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 {
|
|
|
|
position: sticky;
|
2019-02-05 07:31:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.actions {
|
|
|
|
display: grid;
|
|
|
|
grid-gap: $gp;
|
|
|
|
grid-template-columns: auto auto;
|
|
|
|
}
|
|
|
|
</style>
|