From dc7c7a053e8b14a78c75add25bd31a2141d27a47 Mon Sep 17 00:00:00 2001 From: Ricardo M Date: Thu, 25 Jan 2024 17:28:21 +0100 Subject: [PATCH] feat(CanvasForm): Make title sticky Currently, the entire `CanvasForm` scrolls, forcing the title and the close icon to be lost. This commit makes the `Title` sticky, so it can always be visible while the `CanvasForm` can be scrolled. fix: https://github.com/KaotoIO/kaoto-next/issues/682 --- .../Visualization/Canvas/CanvasForm.scss | 4 + .../Visualization/Canvas/CanvasForm.tsx | 44 +++--- .../Visualization/Canvas/CanvasSideBar.scss | 15 +- .../Visualization/Canvas/CanvasSideBar.tsx | 4 +- .../__snapshots__/CanvasForm.test.tsx.snap | 144 ++++++++++-------- 5 files changed, 120 insertions(+), 91 deletions(-) diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.scss b/packages/ui/src/components/Visualization/Canvas/CanvasForm.scss index bfd660d7e..30c5eae0e 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.scss +++ b/packages/ui/src/components/Visualization/Canvas/CanvasForm.scss @@ -10,3 +10,7 @@ form[data-testid='autoform'] > div { display: inherit; gap: inherit; } + +.canvas-form { + overflow: scroll; +} diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx b/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx index 00aa3def0..2645938e0 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx +++ b/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx @@ -85,27 +85,29 @@ export const CanvasForm: FunctionComponent = (props) => { return ( This node cannot be configured yet

}> {componentName} - {isUnknownComponent ? ( - - {stringify(model)} - - ) : ( - - {isExpressionAwareStep && } - {isDataFormatAwareStep && } - {isLoadBalanceAwareStep && } - - - - - - )} +
+ {isUnknownComponent ? ( + + {stringify(model)} + + ) : ( + + {isExpressionAwareStep && } + {isDataFormatAwareStep && } + {isLoadBalanceAwareStep && } + + + + + + )} +
); }; diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.scss b/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.scss index d40f9d8d8..fc425283d 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.scss +++ b/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.scss @@ -1,3 +1,14 @@ -img[class^='sidebar-icon-'] { - max-height: 40px; +.canvas-sidebar { + overflow: scroll; + max-height: 100%; + + img[class^='sidebar-icon-'] { + max-height: 40px; + } + + &__body { + display: flex; + flex-direction: column; + flex-grow: 1; + } } diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx b/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx index 672e24841..00a7c44ca 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx +++ b/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx @@ -19,7 +19,7 @@ export const CanvasSideBar: FunctionComponent = (props) => { * and doesn't take into account the sidebar children. */ - + @@ -37,7 +37,7 @@ export const CanvasSideBar: FunctionComponent = (props) => { - + {props.selectedNode === undefined ? null : ( Something didn't work as expected

}> diff --git a/packages/ui/src/components/Visualization/Canvas/__snapshots__/CanvasForm.test.tsx.snap b/packages/ui/src/components/Visualization/Canvas/__snapshots__/CanvasForm.test.tsx.snap index af8960333..619ecd12a 100644 --- a/packages/ui/src/components/Visualization/Canvas/__snapshots__/CanvasForm.test.tsx.snap +++ b/packages/ui/src/components/Visualization/Canvas/__snapshots__/CanvasForm.test.tsx.snap @@ -10,71 +10,75 @@ exports[`CanvasForm should render 1`] = ` > My Node -
-
-
+ +
- - -
-
- - - + + Name + + + +
+ + +
- +
+ +
-
-
+ + `; @@ -89,21 +93,25 @@ exports[`CanvasForm should render nothing if no schema and no definition is avai My Node
-
-        
-          null
+          
+            null
 
-        
-      
+ + +
@@ -118,18 +126,22 @@ exports[`CanvasForm should render nothing if no schema is available 1`] = ` data-ouia-safe="true" />
-
-        
-      
+
+          
+        
+