Files
CollabTable/frontend/src/lib/components/ui/dialog/content.svelte
T

27 lines
937 B
Svelte
Raw Normal View History

<script>
import { Dialog } from 'bits-ui';
import { X } from '@lucide/svelte';
import { cn } from '$lib/utils/cn.js';
let { ref = $bindable(null), class: className, children, ...restProps } = $props();
</script>
<Dialog.Portal>
<Dialog.Overlay class="fixed inset-0 z-50 bg-black/50 animate-in fade-in-0" />
<Dialog.Content
bind:ref
class={cn(
'fixed left-1/2 top-1/2 z-50 max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-lg border border-border bg-bg p-6 shadow-lg animate-in fade-in-0 zoom-in-95',
className,
)}
{...restProps}
>
{@render children?.()}
<Dialog.Close
class="absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none"
>
<X class="size-4" />
<span class="sr-only">Close</span>
</Dialog.Close>
</Dialog.Content>
</Dialog.Portal>