Skip to content

Commit

Permalink
fix(FlowNode): handle content when already connected
Browse files Browse the repository at this point in the history
  • Loading branch information
MEsteves22 authored and zettca committed Jan 30, 2024
1 parent aed0975 commit cbb231c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
6 changes: 0 additions & 6 deletions packages/lab/src/Flow/Flow.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import { flowBaseNodeClasses } from "./Node";
export const { staticClasses, useClasses } = createClasses("HvFlow", {
root: {
height: "100%",
"& .react-flow__handle-connecting": {
backgroundColor: theme.colors.negative_20,
},
"& .react-flow__handle-valid": {
backgroundColor: theme.colors.positive_20,
},
[`& .selected > .${flowBaseNodeClasses.root}`]: {
border: `1px solid ${theme.colors.secondary_60}`,
borderRadius: theme.radii.round,
Expand Down
11 changes: 11 additions & 0 deletions packages/lab/src/Flow/Node/BaseNode.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export const { staticClasses, useClasses } = createClasses("HvFlowBaseNode", {
"&.react-flow__handle-right": {
right: -21,
},
"&.react-flow__handle-connecting": {
backgroundColor: theme.colors.negative_20,
},
"&.react-flow__handle-valid": {
backgroundColor: theme.colors.positive_20,
},
"::before": {
fontSize: 14,
color: theme.colors.secondary_60,
Expand All @@ -104,6 +110,11 @@ export const { staticClasses, useClasses } = createClasses("HvFlowBaseNode", {
backgroundColor: theme.colors.secondary_60,
width: 8,
height: 8,

"::before": {
fontSize: 11,
marginTop: -8,
},
},
mandatory: {
width: 10,
Expand Down
14 changes: 6 additions & 8 deletions packages/lab/src/Flow/Node/BaseNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,9 @@ export const HvFlowBaseNode = ({
isConnectableEnd={false}
id={output.id}
position={Position.Right}
className={cx(
classes.handle,
edgeConnected && classes.handleConnected
)}
className={cx(classes.handle, {
[classes.handleConnected]: edgeConnected,
})}
/>
{output.isMandatory && !edgeConnected && (
<div className={classes.mandatory} />
Expand All @@ -204,10 +203,9 @@ export const HvFlowBaseNode = ({
isConnectableStart={false}
id={input.id}
position={Position.Left}
className={cx(
classes.handle,
edgeConnected && classes.handleConnected
)}
className={cx(classes.handle, {
[classes.handleConnected]: edgeConnected,
})}
/>
<HvTypography component="div">{input.label}</HvTypography>
{input.isMandatory && !edgeConnected && (
Expand Down

0 comments on commit cbb231c

Please sign in to comment.