diff --git a/striker-ui/components/FormDialog.tsx b/striker-ui/components/FormDialog.tsx index 09630391..1babad4a 100644 --- a/striker-ui/components/FormDialog.tsx +++ b/striker-ui/components/FormDialog.tsx @@ -1,18 +1,46 @@ import { forwardRef, useMemo } from 'react'; import ConfirmDialog from './ConfirmDialog'; +import IconButton from './IconButton'; +import { HeaderText } from './Text'; const FormDialog = forwardRef< ConfirmDialogForwardedRefContent, - ConfirmDialogProps + ConfirmDialogProps & { showClose?: boolean } >((props, ref) => { - const { scrollContent: isScrollContent } = props; + const { scrollContent, showClose, titleText, ...restProps } = props; const scrollBoxPaddingRight = useMemo( - () => (isScrollContent ? '.5em' : undefined), - [isScrollContent], + () => (scrollContent ? '.5em' : undefined), + [scrollContent], ); + const titleElement = useMemo(() => { + const title = + typeof titleText === 'string' ? ( + {titleText} + ) : ( + titleText + ); + + return showClose ? ( + <> + {title} + { + if (ref && 'current' in ref) { + ref.current?.setOpen?.call(null, false); + } + }} + variant="redcontained" + /> + + ) : ( + title + ); + }, [ref, showClose, titleText]); + return ( ); }); +FormDialog.defaultProps = { + showClose: false, +}; + FormDialog.displayName = 'FormDialog'; export default FormDialog; diff --git a/striker-ui/components/ManageFence/ManageFencePanel.tsx b/striker-ui/components/ManageFence/ManageFencePanel.tsx index f52df4af..f6a0937a 100644 --- a/striker-ui/components/ManageFence/ManageFencePanel.tsx +++ b/striker-ui/components/ManageFence/ManageFencePanel.tsx @@ -421,6 +421,7 @@ const ManageFencePanel: FC = () => { preActionArea={messageArea} ref={formDialogRef} scrollContent + showClose /> { preActionArea={messageArea} ref={addManifestFormDialogRef} scrollContent + showClose /> { preActionArea={messageArea} ref={editManifestFormDialogRef} scrollContent + showClose /> { preActionArea={messageArea} ref={runManifestFormDialogRef} scrollContent + showClose /> { loadingAction={isFormSubmitting} preActionArea={messageArea} ref={formDialogRef} + showClose />