2024-10-15 22:52:30 +00:00
|
|
|
<script lang="ts">
|
2024-10-17 23:03:50 +00:00
|
|
|
import {noop} from "@welshman/lib"
|
2024-10-15 22:52:30 +00:00
|
|
|
import {fade, fly} from "@lib/transition"
|
|
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
interface Props {
|
|
|
|
|
onClose?: any
|
|
|
|
|
fullscreen?: boolean
|
|
|
|
|
children?: import("svelte").Snippet
|
|
|
|
|
}
|
2024-10-17 22:02:03 +00:00
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
let {onClose = noop, fullscreen = false, children}: Props = $props()
|
|
|
|
|
|
|
|
|
|
let extraClass = $derived(
|
2024-11-15 22:25:18 +00:00
|
|
|
!fullscreen &&
|
2025-02-04 00:37:14 +00:00
|
|
|
"card2 bg-alt max-h-[90vh] w-[90vw] overflow-auto text-base-content sm:w-[520px] shadow-xl",
|
|
|
|
|
)
|
2024-10-15 22:52:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="center fixed inset-0 z-modal">
|
|
|
|
|
<button
|
2025-02-03 23:01:42 +00:00
|
|
|
aria-label="Close dialog"
|
2024-10-17 22:02:03 +00:00
|
|
|
class="absolute inset-0 cursor-pointer bg-black opacity-75"
|
|
|
|
|
transition:fade={{duration: 300}}
|
2025-02-04 00:37:14 +00:00
|
|
|
onclick={onClose}>
|
2025-02-03 23:01:42 +00:00
|
|
|
</button>
|
2024-10-17 23:03:50 +00:00
|
|
|
<div class="scroll-container relative {extraClass}" transition:fly={{duration: 300}}>
|
2025-02-04 00:37:14 +00:00
|
|
|
{@render children?.()}
|
2024-10-15 22:52:30 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|