Skip to content

Commit

Permalink
Update confirmation-dialog.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
gibberwockie authored and anita-stanisz-sonarsource committed Feb 23, 2024
1 parent 618af52 commit 0e4a511
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions src/common/confirmation-dialog/confirmation-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,42 @@ export default function ConfirmationDialog (
onCancel,
maxWidth = 'sm',
disableActions = false
}: Props
}: Readonly<Props>
) {
const confirm = confirmLabel ?? 'OK'
const cancel = cancelLabel ?? 'Cancel'

return <>
<Dialog
return <Dialog
open={show}
onClose={onCancel}
maxWidth={maxWidth}
fullWidth={true}
scroll={'body'}
keepMounted={false}
>
<DialogTitle children={title}/>
<DialogContent>
{
isString(children)
? <Typography variant={'body1'} children={children} />
: children
}
</DialogContent>
{
!disableActions && <DialogActions style={{ padding: 24 }}>
<Button
color={'secondary'}
onClick={onCancel}
children={cancel}
variant='outlined'
/>
<Button
autoFocus
children={confirm}
onClick={onConfirm}
variant='outlined'
/>
</DialogActions>
}
</Dialog>
</>
<DialogTitle children={title}/>
<DialogContent>
{
isString(children)
? <Typography variant={'body1'} children={children} />
: children
}
</DialogContent>
{
!disableActions && <DialogActions style={{ padding: 24 }}>
<Button
color={'secondary'}
onClick={onCancel}
children={cancel}
variant='outlined'
/>
<Button
autoFocus
children={confirm}
onClick={onConfirm}
variant='outlined'
/>
</DialogActions>
}
</Dialog>
}

0 comments on commit 0e4a511

Please sign in to comment.