fix(striker-ui): expose paper and proceed button props in ConfirmDialog

main
Tsu-ba-me 2 years ago
parent df24ead7e3
commit 1bba020b55
  1. 26
      striker-ui/components/ConfirmDialog.tsx
  2. 2
      striker-ui/types/ConfirmDialog.d.ts

@ -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<boolean>(openInitially);
@ -61,7 +67,10 @@ const ConfirmDialog = forwardRef<
<Dialog
open={open}
PaperComponent={Panel}
PaperProps={{ sx: { overflow: 'visible' } }}
PaperProps={{
...restPaperProps,
sx: { overflow: 'visible', ...paperSx },
}}
{...restDialogProps}
>
<PanelHeader>
@ -92,6 +101,12 @@ const ConfirmDialog = forwardRef<
{actionCancelText}
</ContainedButton>
<ContainedButton
onClick={(...args) => {
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}
</ContainedButton>

@ -1,6 +1,6 @@
type ConfirmDialogOptionalProps = {
actionCancelText?: string;
dialogProps?: import('@mui/material').DialogProps;
dialogProps?: Partial<import('@mui/material').DialogProps>;
onProceedAppend?: ContainedButtonProps['onClick'];
onCancelAppend?: ContainedButtonProps['onClick'];
openInitially?: boolean;

Loading…
Cancel
Save