thedesk/src/components/globals/BaseOverlay.vue

76 lines
1.2 KiB
Vue
Raw Normal View History

2019-04-23 04:43:36 +09:00
<template>
2019-04-24 00:04:29 +09:00
<transition name="fade">
<div class="overlay">
2019-04-24 16:58:25 +09:00
<button type="button" class="close-button" @click="closeOverlay">X</button>
2019-04-24 00:04:29 +09:00
<h1>{{ title }}</h1>
<div class="overlay-inner">
<slot/>
</div>
2019-04-23 04:43:36 +09:00
</div>
2019-04-24 00:04:29 +09:00
</transition>
2019-04-23 04:43:36 +09:00
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
@Component({
inheritAttrs: false,
})
export default class BaseOverlay extends Vue {
@Prop()
public title?: string
public closeOverlay() {
this.$emit('close')
}
}
</script>
<style scoped lang="postcss">
2019-04-24 00:04:29 +09:00
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
2019-04-23 04:43:36 +09:00
.overlay {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100vw;
2019-04-24 16:58:25 +09:00
max-width: 100vw;
2019-04-23 04:43:36 +09:00
height: 100vh;
2019-04-24 16:58:25 +09:00
max-height: 100vh;
2019-04-24 00:04:29 +09:00
background-color: var(--bg-color);
2019-04-23 04:43:36 +09:00
}
.overlay-inner {
2019-04-24 16:58:25 +09:00
margin: 0.5em;
height: calc(100% - 50px - 1em);
overflow: scroll;
2019-04-23 04:43:36 +09:00
}
.close-button {
position: fixed;
top: 0;
right: 0;
color: var(--color);
border: none;
background-color: transparent;
z-index: 100;
width: 50px;
height: 50px;
2019-04-24 16:58:25 +09:00
font-size: 1.5rem;
2019-04-23 04:43:36 +09:00
}
h1 {
top: 0;
line-height: 50px;
font-size: 1.5em;
margin: 0;
}
</style>