From 51f7337782c238ecb7d43490268bf90b856150a2 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 18 Mar 2022 17:33:05 -0300 Subject: [PATCH] 16672: Adds new prop to MPVContent: max height when not maximized. This applies to the Log panel so that it doesn't take the whole vertical space available when sharing the UI with other panels. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../multi-panel-view/multi-panel-view.tsx | 15 ++++++++++++--- src/views/process-panel/process-panel-root.tsx | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/multi-panel-view/multi-panel-view.tsx b/src/components/multi-panel-view/multi-panel-view.tsx index b242f805..48241c0b 100644 --- a/src/components/multi-panel-view/multi-panel-view.tsx +++ b/src/components/multi-panel-view/multi-panel-view.tsx @@ -33,7 +33,6 @@ const styles: StyleRulesCallback = theme => ({ }, content: { overflow: 'auto', - height: '100%', }, }); @@ -66,6 +65,7 @@ interface MPVPanelDataProps { panelIlluminated?: boolean; panelRef?: MutableRefObject; forwardProps?: boolean; + maxHeight?: string; } interface MPVPanelActionProps { @@ -79,14 +79,23 @@ export type MPVPanelProps = MPVPanelDataProps & MPVPanelActionProps; type MPVPanelContentProps = {children: ReactElement} & MPVPanelProps & GridProps; // Grid item compatible component for layout and MPV props passing -export const MPVPanelContent = ({doHidePanel, doMaximizePanel, panelName, panelMaximized, panelIlluminated, panelRef, forwardProps, ...props}: MPVPanelContentProps) => { +export const MPVPanelContent = ({doHidePanel, doMaximizePanel, panelName, + panelMaximized, panelIlluminated, panelRef, forwardProps, maxHeight, + ...props}: MPVPanelContentProps) => { useEffect(() => { if (panelRef && panelRef.current) { panelRef.current.scrollIntoView({behavior: 'smooth'}); } }, [panelRef]); - return + // If maxHeight is set, only apply it when not maximized + const mh = maxHeight + ? panelMaximized + ? '100%' + : maxHeight + : undefined; + + return {/* Element to scroll to when the panel is selected */} { forwardProps diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx index cf32b50f..78c79f8f 100644 --- a/src/views/process-panel/process-panel-root.tsx +++ b/src/views/process-panel/process-panel-root.tsx @@ -70,7 +70,7 @@ export const ProcessPanelRoot = withStyles(styles)( - +