🎉 Init

This commit is contained in:
2026-08-21 15:29:01 +02:00
commit 02e5b1f4e4
33 changed files with 11392 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
<template>
<Transition
enter-active-class="transition duration-150 ease-out"
enter-from-class="opacity-0"
enter-to-class="opacity-100"
leave-active-class="transition duration-100 ease-in"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div
v-if="popup?.config"
class="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 backdrop-blur-[2px]"
@click="closeOutside"
>
<div
class="flex max-h-[calc(100vh-4rem)] w-full flex-col rounded-lg border border-border bg-surface shadow-xl shadow-black/20"
:class="sizeClass"
@click.stop
>
<div class="flex shrink-0 items-center justify-between border-b border-border px-5 py-4">
<h2 class="text-sm font-semibold tracking-[0.04em] text-text">{{ popup.config.heading }}</h2>
<button type="button" class="text-muted transition-colors hover:text-text" @click="usePopup().close()">
<span class="material-symbols-outlined">close</span>
</button>
</div>
<div class="min-h-0 flex-1 overflow-y-auto p-5">
<component :is="popup.component" />
</div>
</div>
</div>
</Transition>
</template>
<script setup lang="ts">
import { computed, onMounted, onUnmounted } from 'vue'
import { PopupSize } from '~/utils/popup'
const popup = computed(() => usePopup().get())
const sizeClass = computed(() => {
switch (popup.value?.config?.size) {
case PopupSize.SMALL:
return 'max-w-md'
case PopupSize.LARGE:
return 'max-w-4xl'
case PopupSize.FULL:
return 'max-w-[calc(100vw-2rem)]'
default:
return 'max-w-xl'
}
})
function closeOutside() {
if (popup.value?.config?.closeOnOverlayClick) {
usePopup().close()
}
}
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape') {
usePopup().close()
}
}
onMounted(() => document.addEventListener('keydown', handleKeydown))
onUnmounted(() => document.removeEventListener('keydown', handleKeydown))
</script>