fix(striker-ui): allow pre-config confirm dialog close-on-proceed

main
Tsu-ba-me 11 months ago
parent e2a61619b0
commit 62b2f69aa4
  1. 17
      striker-ui/hooks/useConfirmDialog.tsx

@ -25,7 +25,12 @@ const useConfirmDialog = (
finishConfirm: (title: ReactNode, message: Message) => void; finishConfirm: (title: ReactNode, message: Message) => void;
} => { } => {
const { const {
initial: { actionProceedText = '', content = '', titleText = '' } = {}, initial: {
actionProceedText = '',
closeOnProceed,
content = '',
titleText = '',
} = {},
} = args; } = args;
const confirmDialogRef = useRef<ConfirmDialogForwardedRefContent | null>( const confirmDialogRef = useRef<ConfirmDialogForwardedRefContent | null>(
@ -57,8 +62,14 @@ const useConfirmDialog = (
); );
const confirmDialog = useMemo<ReactElement>( const confirmDialog = useMemo<ReactElement>(
() => <ConfirmDialog {...confirmDialogProps} ref={confirmDialogRef} />, () => (
[confirmDialogProps], <ConfirmDialog
closeOnProceed={closeOnProceed}
{...confirmDialogProps}
ref={confirmDialogRef}
/>
),
[closeOnProceed, confirmDialogProps],
); );
return { return {

Loading…
Cancel
Save