aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Control/Modal.vue
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2024-02-15 17:23:22 +0000
committerLeonardo Bishop <me@leonardobishop.com>2024-02-15 17:23:22 +0000
commit0f2240c87a5c0a22e2db97e4d2b82a52401be668 (patch)
treed223cd64fb588b6668d55cd9e2dff889d62f81bb /src/components/Control/Modal.vue
parent1f555cf695079d6cc85581a480f375210b0c045c (diff)
Add modals
Diffstat (limited to 'src/components/Control/Modal.vue')
-rw-r--r--src/components/Control/Modal.vue67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/components/Control/Modal.vue b/src/components/Control/Modal.vue
new file mode 100644
index 0000000..d47d281
--- /dev/null
+++ b/src/components/Control/Modal.vue
@@ -0,0 +1,67 @@
+<script setup lang="ts">
+const model = defineModel();
+
+</script>
+
+<template>
+ <div id="modal" class="modal" :class="{ 'is-active': model }">
+ <div class="modal-background" @click="model = false"></div>
+ <div class="modal-content">
+ <div class="header" v-if="$slots.header">
+ <slot name="header" />
+ </div>
+ <slot name="body" />
+ <slot />
+ </div>
+ </div>
+</template>
+
+<style scoped>
+#modal {
+ align-items: center;
+ justify-content: center;
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 1000;
+ background-color: rgba(0, 0, 0, 0.5);
+ transition: opacity 0.3s;
+ display: none;
+}
+
+.modal-content {
+ background-color: var(--color-background);
+ border: 1px solid var(--color-border);
+ padding: 1rem;
+ width: 100%;
+ max-width: 600px;
+ max-height: 80%;
+ overflow-y: auto;
+ border-radius: 4px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
+}
+
+.modal-background {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.5);
+ z-index: -1;
+}
+
+.is-active {
+ opacity: 1 !important;
+ pointer-events: all !important;
+ display: flex !important;
+}
+
+.header {
+ border-bottom: 1px solid var(--color-border);
+ margin-bottom: 1rem;
+}
+
+</style> \ No newline at end of file