fix(striker-ui): allow react elements in ConfirmDialog titleText

main
Tsu-ba-me 2 years ago
parent e755ae4fe8
commit efd70bd1d4
  1. 14
      striker-ui/components/ConfirmDialog.tsx
  2. 4
      striker-ui/types/ConfirmDialog.d.ts

@ -164,6 +164,7 @@ const ConfirmDialog = forwardRef<
restProceedButtonProps,
],
);
const actionAreaElement = useMemo(
() =>
isLoadingAction ? (
@ -185,6 +186,15 @@ const ConfirmDialog = forwardRef<
typeof content === 'string' ? <BodyText text={content} /> : content,
[content],
);
const headerElement = useMemo(
() =>
typeof titleText === 'string' ? (
<HeaderText>{titleText}</HeaderText>
) : (
titleText
),
[titleText],
);
const combinedScrollBoxSx = useMemo<SxProps<Theme> | undefined>(
() =>
isScrollContent
@ -216,9 +226,7 @@ const ConfirmDialog = forwardRef<
}}
{...restDialogProps}
>
<PanelHeader>
<HeaderText text={titleText} />
</PanelHeader>
<PanelHeader>{headerElement}</PanelHeader>
<FlexBox
component={contentContainerComponent}
onSubmit={contentContainerSubmitEventHandler}

@ -18,8 +18,8 @@ type ConfirmDialogOptionalProps = {
type ConfirmDialogProps = ConfirmDialogOptionalProps & {
actionProceedText: string;
content: import('@mui/material').ReactNode;
titleText: string;
content: import('react').ReactNode;
titleText: import('react').ReactNode;
};
type ConfirmDialogForwardedRefContent = {

Loading…
Cancel
Save