From f38329f675084bb9d63c8f6ed5e968e8d7dd2a2f Mon Sep 17 00:00:00 2001 From: alimpens Date: Wed, 11 Sep 2024 09:51:10 +0200 Subject: [PATCH] Group function declarations --- packages/react/src/Dialog/Dialog.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react/src/Dialog/Dialog.tsx b/packages/react/src/Dialog/Dialog.tsx index e52ffa5669..275641539f 100644 --- a/packages/react/src/Dialog/Dialog.tsx +++ b/packages/react/src/Dialog/Dialog.tsx @@ -19,6 +19,7 @@ export type DialogProps = { } & PropsWithChildren> const closeDialog = (event: MouseEvent) => event.currentTarget.closest('dialog')?.close() +const openDialog = (id: string) => (document.querySelector(id) as HTMLDialogElement)?.showModal() const DialogRoot = forwardRef( ( @@ -42,5 +43,5 @@ DialogRoot.displayName = 'Dialog' export const Dialog = Object.assign(DialogRoot, { close: closeDialog, - open: (id: string) => (document.querySelector(id) as HTMLDialogElement)?.showModal(), + open: openDialog, })