From 9267ef28e3dda67723c6e356ec9e91cb040fe4b9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 18 Feb 2024 13:18:07 -0600 Subject: [PATCH] Modal: support back button --- src/components/ui/modal/modal.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/ui/modal/modal.tsx b/src/components/ui/modal/modal.tsx index dd4541ae3..85f8fc168 100644 --- a/src/components/ui/modal/modal.tsx +++ b/src/components/ui/modal/modal.tsx @@ -8,6 +8,7 @@ import HStack from '../hstack/hstack'; import IconButton from '../icon-button/icon-button'; const messages = defineMessages({ + back: { id: 'card.back.label', defaultMessage: 'Back' }, close: { id: 'lightbox.close', defaultMessage: 'Close' }, confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, }); @@ -56,6 +57,7 @@ interface IModal { width?: keyof typeof widths; children?: React.ReactNode; className?: string; + onBack?: () => void; } /** Displays a modal dialog box. */ @@ -78,6 +80,7 @@ const Modal = React.forwardRef(({ title, width = 'xl', className, + onBack, }, ref) => { const intl = useIntl(); const buttonRef = React.useRef(null); @@ -102,6 +105,15 @@ const Modal = React.forwardRef(({ 'flex-row-reverse': closePosition === 'left', })} > + {onBack && ( + + )} +

{title}