Skip to content

Commit

Permalink
Group function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpens committed Sep 11, 2024
1 parent ffd67d4 commit f38329f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react/src/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type DialogProps = {
} & PropsWithChildren<DialogHTMLAttributes<HTMLDialogElement>>

const closeDialog = (event: MouseEvent<HTMLButtonElement>) => event.currentTarget.closest('dialog')?.close()
const openDialog = (id: string) => (document.querySelector(id) as HTMLDialogElement)?.showModal()

const DialogRoot = forwardRef(
(
Expand All @@ -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,
})

0 comments on commit f38329f

Please sign in to comment.