Files
dotter/resources/js/components/ui/dialog/DialogClose.svelte
T
salam e687b4437b
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s
first commit
2026-10-06 18:53:03 +02:00

20 lines
593 B
Svelte

<script lang="ts">
import type { Snippet } from 'svelte';
import { getContext } from 'svelte';
import { DIALOG_CONTEXT, type DialogContext } from './context';
let { asChild = false, children }: { asChild?: boolean; children?: Snippet<[Record<string, unknown>]> } = $props();
const { setOpen } = getContext<DialogContext>(DIALOG_CONTEXT);
const handleClick = () => setOpen(false);
</script>
{#if asChild}
{@render children?.({ onClick: handleClick })}
{:else}
<button type="button" onclick={handleClick}>
{@render children?.({})}
</button>
{/if}