tethys/resources/js/components/ShowModal.vue

101 lines
2.0 KiB
Vue
Raw Permalink Normal View History

2019-04-16 12:35:16 +00:00
<template>
<transition name="modal-fade">
<div class="modal-backdrop">
<div class="modal" role="dialog" aria-labelledby="modalTitle" aria-describedby="modalDescription">
<header class="modal-header" id="modalTitle">
<slot name="header">
This is the default tile!
<button type="button" class="btn-close" v-on:click="close" aria-label="Close modal">x</button>
</slot>
</header>
<section class="modal-body" id="modalDescription">
<slot name="body">I'm the default body!</slot>
2019-01-30 16:46:12 +00:00
</section>
<footer class="modal-footer">
<slot name="footer">
<button type="button" class="btn-green" v-on:click="close" aria-label="Close modal">Close me!</button>
</slot>
</footer>
</div>
2019-01-30 16:46:12 +00:00
</div>
</transition>
2019-01-30 16:46:12 +00:00
</template>
2019-01-30 16:46:12 +00:00
<script>
// https://alligator.io/vuejs/vue-modal-component/
import { Component, Vue } from "vue-property-decorator";
2019-01-30 16:46:12 +00:00
@Component({})
export default class Modal extends Vue {
close() {
2019-01-30 16:46:12 +00:00
this.$emit("close");
}
2019-01-30 16:46:12 +00:00
}
</script>
2019-01-30 16:46:12 +00:00
<style>
2019-01-30 16:46:12 +00:00
.modal-backdrop {
position: fixed;
2019-01-30 16:46:12 +00:00
top: 0;
bottom: 0;
left: 0;
right:0;
2019-01-30 16:46:12 +00:00
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
z-index: 1001;
2019-01-30 16:46:12 +00:00
}
.modal {
background: #ffffff;
box-shadow: 2px 2px 20px 1px;
overflow-x: auto;
display: flex;
flex-direction: column;
width: 80%;
2019-01-30 16:46:12 +00:00
}
.modal-header,
.modal-footer {
padding: 15px;
display: flex;
}
.modal-header {
border-bottom: 1px solid #eeeeee;
color: #4aae9b;
justify-content: space-between;
}
.modal-footer {
border-top: 1px solid #eeeeee;
justify-content: flex-end;
}
.modal-body {
position: relative;
padding: 20px 10px;
}
.btn-close {
border: none;
font-size: 20px;
padding: 20px;
cursor: pointer;
2019-01-30 16:46:12 +00:00
font-weight: bold;
color: #4aae9b;
background: transparent;
}
.btn-green {
color: white;
background: #4aae9b;
border: 1px solid #4aae9b;
border-radius: 2px;
}
</style>