From 8ebe6e70b751b972d29e6f25a4dd30eee28d5429 Mon Sep 17 00:00:00 2001 From: jona42-ui Date: Fri, 23 Jun 2023 09:51:53 +0300 Subject: [PATCH] O3-2212:React Forms: Don't show Form nav in Single Page forms --- .../sidebar/ohri-form-sidebar.component.tsx | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/components/sidebar/ohri-form-sidebar.component.tsx b/src/components/sidebar/ohri-form-sidebar.component.tsx index b25d7e91b..cacc8f883 100644 --- a/src/components/sidebar/ohri-form-sidebar.component.tsx +++ b/src/components/sidebar/ohri-form-sidebar.component.tsx @@ -63,30 +63,38 @@ function OHRIFormSidebar({ }, [unspecifiedFields], ); + + // Check if there is only one scrollable page + const isSinglePage = scrollablePages.length === 1; + return (
- {[...scrollablePages].map((page, index) => { - return ( - !page.isHidden && ( - - ) - ); - })} - {mode !== 'view' &&
} + {!isSinglePage && ( + <> + {[...scrollablePages].map((page, index) => { + return ( + !page.isHidden && ( + + ) + ); + })} +
+ + )}
{allowUnspecifiedAll && mode !== 'view' && (
@@ -99,7 +107,7 @@ function OHRIFormSidebar({ />
)} - {mode != 'view' && ( + {mode !== 'view' && ( @@ -111,7 +119,7 @@ function OHRIFormSidebar({ onCancel && onCancel(); handleClose && handleClose(); }}> - {mode == 'view' ? 'Close' : 'Cancel'} + {mode === 'view' ? 'Close' : 'Cancel'}