2024-10-15 22:52:30 +00:00
|
|
|
<script lang="ts">
|
2025-11-03 22:43:27 +00:00
|
|
|
import cx from "classnames"
|
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 01:21:46 +00:00
|
|
|
const {onClose = noop, fullscreen = false, children}: Props = $props()
|
2025-02-04 00:37:14 +00:00
|
|
|
|
2025-02-04 01:21:46 +00:00
|
|
|
const extraClass = $derived(
|
2024-11-15 22:25:18 +00:00
|
|
|
!fullscreen &&
|
2025-11-03 22:43:27 +00:00
|
|
|
cx(
|
2025-11-05 23:32:55 +00:00
|
|
|
"bg-alt text-base-content overflow-auto text-base-content shadow-md",
|
2025-11-04 17:05:17 +00:00
|
|
|
"px-4 py-6 bottom-0 left-0 right-0 top-20 rounded-t-box absolute",
|
2025-11-13 21:25:34 +00:00
|
|
|
"sm:p-6 sm:max-h-[90vh] sm:w-[520px] sm:rounded-box sm:relative sm:top-0 sm:relative",
|
2025-11-03 22:43:27 +00:00
|
|
|
),
|
2025-02-04 00:37:14 +00:00
|
|
|
)
|
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"
|
2025-09-11 21:47:06 +00:00
|
|
|
class="absolute inset-0 cursor-pointer bg-[#ccc] opacity-75 dark:bg-black"
|
2024-10-17 22:02:03 +00:00
|
|
|
transition:fade={{duration: 300}}
|
2025-02-04 00:37:14 +00:00
|
|
|
onclick={onClose}>
|
2025-02-03 23:01:42 +00:00
|
|
|
</button>
|
2025-12-05 00:01:39 +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>
|