From 1bba020b5547cdefd9ac2a8a76211f3ce8b951bf Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 23 Nov 2022 22:55:24 -0500 Subject: [PATCH] fix(striker-ui): expose paper and proceed button props in ConfirmDialog --- striker-ui/components/ConfirmDialog.tsx | 26 +++++++++++++++++-------- striker-ui/types/ConfirmDialog.d.ts | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/striker-ui/components/ConfirmDialog.tsx b/striker-ui/components/ConfirmDialog.tsx index 6e86ef24..145067da 100644 --- a/striker-ui/components/ConfirmDialog.tsx +++ b/striker-ui/components/ConfirmDialog.tsx @@ -24,7 +24,11 @@ const ConfirmDialog = forwardRef< actionCancelText = 'Cancel', actionProceedText, content, - dialogProps: { open: baseOpen = false, ...restDialogProps } = {}, + dialogProps: { + open: baseOpen = false, + PaperProps: paperProps = {}, + ...restDialogProps + } = {}, onCancelAppend, onProceedAppend, openInitially = false, @@ -34,7 +38,9 @@ const ConfirmDialog = forwardRef< }, ref, ) => { - const { sx: proceedButtonSx } = proceedButtonProps; + const { sx: paperSx, ...restPaperProps } = paperProps; + const { sx: proceedButtonSx, ...restProceedButtonProps } = + proceedButtonProps; const [isOpen, setIsOpen] = useState(openInitially); @@ -61,7 +67,10 @@ const ConfirmDialog = forwardRef< @@ -92,6 +101,12 @@ const ConfirmDialog = forwardRef< {actionCancelText} { + setIsOpen(false); + + onProceedAppend?.call(null, ...args); + }} + {...restProceedButtonProps} sx={{ backgroundColor: proceedColour, color: TEXT, @@ -100,11 +115,6 @@ const ConfirmDialog = forwardRef< ...proceedButtonSx, }} - onClick={(...args) => { - setIsOpen(false); - - onProceedAppend?.call(null, ...args); - }} > {actionProceedText} diff --git a/striker-ui/types/ConfirmDialog.d.ts b/striker-ui/types/ConfirmDialog.d.ts index d0e4df00..bc7d10b3 100644 --- a/striker-ui/types/ConfirmDialog.d.ts +++ b/striker-ui/types/ConfirmDialog.d.ts @@ -1,6 +1,6 @@ type ConfirmDialogOptionalProps = { actionCancelText?: string; - dialogProps?: import('@mui/material').DialogProps; + dialogProps?: Partial; onProceedAppend?: ContainedButtonProps['onClick']; onCancelAppend?: ContainedButtonProps['onClick']; openInitially?: boolean;