add ModalWindow component

This commit is contained in:
2022-11-23 08:31:58 +01:00
parent cd80bf5e70
commit 850b16e113
2 changed files with 102 additions and 67 deletions

View File

@@ -1,50 +1,20 @@
<script>
import { defineComponent } from 'vue';
import ModalWindow from './ModalWindow.vue';
export default defineComponent({
name: 'HelpModal',
props: {
visible: Boolean,
},
components: {
ModalWindow,
},
});
</script>
<style lang="scss" scoped>
$padding: 12px;
.help-modal {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
padding: 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
display: flex;
justify-content: center;
align-items: center;
visibility: hidden;
&.visible {
visibility: visible;
}
.window {
padding: $padding $padding * 4;
border-radius: $padding * 2;
// height: calc(100% - 100px);
// width: calc(100% - 100px);
line-height: 1.5;
font-family: monospace;
background-color: rgba(0, 0, 0, 0.6);
border: 1px solid rgba(32, 32, 32, 0.6);
overflow-y: auto;
ul {
ul {
list-style-type: none;
padding: 0;
@@ -68,26 +38,20 @@ $padding: 12px;
text-align: left;
}
}
}
}
b {
b {
color: #8f8;
}
}
}
</style>
<template>
<div
class="help-modal"
:class="{ visible: this.visible }"
@click="$emit('close')"
>
<div class="window" @click.stop>
<div class="header">
<div class="help-modal">
<ModalWindow :visible="visible" @close="$emit('close')">
<template #header>
<h3>Keyboard Shortcuts</h3>
</div>
<div class="content">
</template>
<template #body>
<!-- -->
<ul>
<li>
@@ -111,7 +75,10 @@ $padding: 12px;
<span>- close window</span>
</li>
</ul>
</div>
</div>
</template>
<!-- <template #footer>
<button @click="showModal = false">close</button>
</template> -->
</ModalWindow>
</div>
</template>

View File

@@ -0,0 +1,68 @@
<script>
import { defineComponent } from 'vue';
export default defineComponent({
name: 'ModalWindow',
props: {
visible: Boolean,
},
});
</script>
<style lang="scss" scoped>
$padding: 12px;
.modal-window {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
padding: 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
display: flex;
justify-content: center;
align-items: center;
visibility: hidden;
&.visible {
visibility: visible;
}
.window {
padding: $padding $padding * 4;
border-radius: $padding * 2;
// height: calc(100% - 100px);
// width: calc(100% - 100px);
line-height: 1.5;
font-family: monospace;
background-color: rgba(0, 0, 0, 0.6);
border: 1px solid rgba(32, 32, 32, 0.6);
overflow-y: auto;
}
}
</style>
<template>
<div
class="modal-window"
:class="{ visible: this.visible }"
@click="$emit('close')"
>
<div class="window" @click.stop>
<div class="header">
<slot name="header" />
</div>
<div class="body">
<slot name="body" />
</div>
<div class="footer">
<slot name="footer" />
</div>
</div>
</div>
</template>