fix(striker-ui): allow ReactNode as ConfirmDialog content

This commit is contained in:
Tsu-ba-me 2022-05-10 17:15:04 -04:00
parent 6c0af0bb1d
commit 7b4272aa0a

View File

@ -1,4 +1,4 @@
import { MouseEventHandler } from 'react'; import { MouseEventHandler, ReactNode } from 'react';
import { Box, ButtonProps, Dialog, DialogProps } from '@mui/material'; import { Box, ButtonProps, Dialog, DialogProps } from '@mui/material';
import ContainedButton from './ContainedButton'; import ContainedButton from './ContainedButton';
@ -8,7 +8,7 @@ import { BodyText, HeaderText } from './Text';
type ConfirmDialogProps = { type ConfirmDialogProps = {
actionCancelText?: string; actionCancelText?: string;
actionProceedText: string; actionProceedText: string;
contentText: string; content: ReactNode | string;
dialogProps: DialogProps; dialogProps: DialogProps;
onCancel: MouseEventHandler<HTMLButtonElement>; onCancel: MouseEventHandler<HTMLButtonElement>;
onProceed: MouseEventHandler<HTMLButtonElement>; onProceed: MouseEventHandler<HTMLButtonElement>;
@ -25,7 +25,7 @@ const ConfirmDialog = (
{ {
actionCancelText, actionCancelText,
actionProceedText, actionProceedText,
contentText, content,
dialogProps: { open }, dialogProps: { open },
onCancel, onCancel,
onProceed, onProceed,
@ -41,7 +41,9 @@ const ConfirmDialog = (
<PanelHeader> <PanelHeader>
<HeaderText text={titleText} /> <HeaderText text={titleText} />
</PanelHeader> </PanelHeader>
<BodyText sx={{ marginBottom: '1em' }} text={contentText} /> <Box sx={{ marginBottom: '1em' }}>
{typeof content === 'string' ? <BodyText text={content} /> : content}
</Box>
<Box <Box
sx={{ sx={{
display: 'flex', display: 'flex',