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

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

Loading…
Cancel
Save