Skip to content

Commit

Permalink
Added fix for providing React flow flex dimensions
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Porter <jason@union.ai>
  • Loading branch information
jsonporter committed Sep 24, 2021
1 parent 338ab1f commit e9f283c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/components/Workflow/StaticGraphContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ export interface StaticGraphContainerProps {
export const StaticGraphContainer: React.FC<StaticGraphContainerProps> = ({
workflowId
}) => {
const containerStyle = {
width: '100%',
height: '30%',
maxHeight: '400px',
minHeight: '220px'
const containerStyle: React.CSSProperties = {
display: 'flex',
flexDirection: 'column',
flex: `1 1 100%`,
minHeight: 300,
padding: '1rem 0'
};
const workflowQuery = useQuery<Workflow, Error>(
makeWorkflowQuery(useQueryClient(), workflowId)
Expand Down
13 changes: 11 additions & 2 deletions src/components/flytegraph/ReactFlow/ReactFlowGraphComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ const ReactFlowGraphComponent = props => {
rfGraphJson: rfGraphJson,
type: RFGraphTypes.main
};

const containerStyle: React.CSSProperties = {
display: 'flex',
flex: `1 1 100%`,
flexDirection: 'column',
minHeight: '100px',
minWidth: '200px'
};

return (
<>
<div style={containerStyle}>
<Legend />
<ReactFlowWrapper {...ReactFlowProps} />
</>
</div>
);
};

Expand Down
4 changes: 3 additions & 1 deletion src/components/flytegraph/ReactFlow/ReactFlowWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ export const ReactFlowWrapper: React.FC<RFWrapperProps> = ({
* React Flow's min height to make it render
*/
const reactFlowStyle: React.CSSProperties = {
minHeight: 220
display: 'flex',
flex: `1 1 100%`,
flexDirection: 'column'
};

return (
Expand Down

0 comments on commit e9f283c

Please sign in to comment.