2024-08-02 15:33:18 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type { Snippet } from "svelte";
|
|
|
|
|
|
|
|
|
|
const { children, id, text } = $props<{ children: Snippet; id: string; text: string }>();
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<a href={`#${id}`} role="button">{text}</a>
|
|
|
|
|
|
|
|
|
|
<div {id} class="modal">
|
|
|
|
|
<div class="modal__content">
|
|
|
|
|
{@render children()}
|
|
|
|
|
<a href="#!" role="button">Close</a>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="#!" class="modal__closeoverlay" aria-label="Close modal"></a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.modal {
|
|
|
|
|
position: fixed;
|
|
|
|
|
inset: 0;
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal:target {
|
2024-08-03 18:07:27 +02:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
2024-08-15 16:26:32 +02:00
|
|
|
padding: var(--space-s);
|
2024-08-02 15:33:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal__closeoverlay {
|
|
|
|
|
position: fixed;
|
|
|
|
|
inset: 0;
|
|
|
|
|
z-index: 10;
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal__content {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2024-08-15 16:26:32 +02:00
|
|
|
gap: var(--space-s);
|
|
|
|
|
padding-inline: var(--space-s);
|
|
|
|
|
padding-block: var(--space-m);
|
2024-08-02 15:33:18 +02:00
|
|
|
background-color: var(--bg-primary);
|
|
|
|
|
border-radius: var(--border-radius);
|
|
|
|
|
border: var(--border-primary);
|
2024-08-03 18:07:27 +02:00
|
|
|
inline-size: 300px;
|
|
|
|
|
max-inline-size: 100%;
|
2024-08-15 16:26:32 +02:00
|
|
|
max-block-size: calc(100vh - var(--space-m));
|
2024-08-03 18:07:27 +02:00
|
|
|
overflow-y: auto;
|
2024-08-02 15:33:18 +02:00
|
|
|
z-index: 20;
|
|
|
|
|
}
|
|
|
|
|
</style>
|