feat: add modal component

This commit is contained in:
madkarmaa
2025-11-13 15:05:57 +01:00
parent 2adca8ce00
commit e7fc9a8be9
3 changed files with 59 additions and 2 deletions

View File

@@ -60,7 +60,7 @@
position: sticky;
top: 0;
left: 0;
z-index: 9999;
z-index: 9998;
&.info {
}

View File

@@ -0,0 +1,57 @@
<script lang="ts">
import type { WithChildren } from '$types';
import type { Snippet } from 'svelte';
type Props = {
buttons?: Snippet;
} & WithChildren;
let { buttons, children }: Props = $props();
</script>
<div class="background">
<div class="modal rounded">
<div class="content">
{@render children()}
</div>
{#if buttons}
<div class="buttons">
{@render buttons()}
</div>
{/if}
</div>
</div>
<style>
.background {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.3);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.modal {
padding: 2rem;
max-width: 90vw;
max-height: 90vh;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.content {
flex: 1;
}
.buttons {
display: flex;
gap: 1rem;
justify-content: flex-end;
}
</style>

View File

@@ -46,7 +46,7 @@
position: sticky;
top: 0;
left: 0;
z-index: 9999;
z-index: 9998;
}
.nav-group {