Skip to content

Commit 6b3fa9c

Browse files
committed
added code
1 parent ce832b2 commit 6b3fa9c

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

app/index.css

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
.dndflow .dndnode.process {
4646
background-color: white;
47-
border-color: #ff0072;
47+
border-color: #f57dbd;
4848
}
4949

5050
.dndflow .reactflow-wrapper {
@@ -92,11 +92,21 @@
9292
border-radius: var(--xy-node-border-radius-default);
9393
background-color: var(--xy-node-background-color-default);
9494
text-align: center;
95-
padding: 10px;
95+
padding: 15px 20px;
9696
font-size: 12px;
9797
border: var(--xy-node-border-default);
9898
border-color: var(--xy-theme-selected);
99-
color: var(--xy-node-color-default);
99+
color: #cb458d;
100+
}
101+
102+
/*
103+
this is styling for a
104+
process react-flow-node
105+
which is not a descendant of any stage
106+
*/
107+
108+
.independent-process-node {
109+
background-color: #fff0f5;
100110
}
101111

102112
.react-flow__node.selectable:focus {
@@ -115,7 +125,9 @@
115125
}
116126

117127
.react-flow__node-LabeledGroupNode {
118-
background-color: rgba(207, 182, 255, 0.4) !important;
128+
padding: 0;
129+
background-color: rgba(207, 182, 255, 0.4);
130+
color: #704af2;
119131
}
120132

121133
.react-flow__node-LabeledGroupNode.selectable {
@@ -130,18 +142,31 @@
130142
border-color: black;
131143
}
132144

133-
.react-flow__node-group {
134-
background-color: rgba(207, 182, 255, 0.4);
135-
border-color: #9e86ed;
136-
}
137-
138145
.react-flow__edge.selectable:hover .react-flow__edge-path,
139146
.react-flow__edge.selectable.selected .react-flow__edge-path {
140147
stroke: var(--xy-theme-edge-hover);
141148
}
142149

143150
.react-flow__handle {
144151
background-color: var(--xy-handle-background-color-default);
152+
width: 10px;
153+
height: 10px;
154+
}
155+
156+
.react-flow__node .react-flow__handle.connectionindicator,
157+
.react-flow__node .react-flow__handle {
158+
background-color: #cb458d;
159+
border-color: white;
160+
width: 10px;
161+
height: 10px;
162+
}
163+
164+
.react-flow__node-LabeledGroupNode .react-flow__handle.connectionindicator,
165+
.react-flow__node-LabeledGroupNode .react-flow__handle {
166+
background-color: #704af2;
167+
border-color: white;
168+
width: 14px;
169+
height: 14px;
145170
}
146171

147172
.react-flow__handle.connectionindicator:hover {
@@ -150,10 +175,21 @@
150175
background-color: white;
151176
}
152177

178+
.react-flow__node .react-flow__handle.connectionindicator:hover {
179+
background-color: white;
180+
border-color: #cb458d;
181+
}
182+
183+
.react-flow__node-LabeledGroupNode
184+
.react-flow__handle.connectionindicator:hover {
185+
background-color: white;
186+
border-color: #704af2;
187+
}
188+
153189
.react-flow__handle.connectionindicator:focus,
154190
.react-flow__handle.connectingfrom,
155191
.react-flow__handle.connectingto {
156-
border-color: var(--xy-theme-edge-hover);
192+
border-color: white;
157193
}
158194

159195
.react-flow__node-resizer {

app/page.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ export default function Page() {
4343
const [nodes, setNodes] = useNodesState([]);
4444
const [edges, setEdges] = useEdgesState([]);
4545

46-
console.log(edges);
47-
console.log(nodes);
48-
4946
// drag and drop providers setup
5047
const { screenToFlowPosition } = useReactFlow();
5148
const [type] = useDnD();
@@ -185,6 +182,8 @@ export default function Page() {
185182
newNode.position.x - bestParent.parentNode.position.x;
186183
newNode.position.y =
187184
newNode.position.y - bestParent.parentNode.position.y;
185+
} else {
186+
newNode.className = "independent-process-node";
188187
}
189188

190189
// Add the new node to the state

components/base-node.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export const BaseNode = React.forwardRef<
55
HTMLDivElement,
66
React.HTMLAttributes<HTMLDivElement> & { selected?: boolean }
77
>(({ className, selected, ...props }, ref) => (
8-
<div ref={ref} className={cn("p-5", className)} {...props} />
8+
<div ref={ref} className={cn(className)} {...props} />
99
));
1010
BaseNode.displayName = "BaseNode";

components/custom-child-node.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ import { BaseNode } from "@/components/base-node";
44
export function CustomChildNode({ data, selected }: any) {
55
const { label } = data;
66
return (
7-
<BaseNode
8-
selected={selected}
9-
className="h-full overflow-hidden rounded-sm"
10-
>
7+
<BaseNode selected={selected}>
118
{label && (
12-
<div className="flex h-full w-full items-end justify-between">
9+
<div>
1310
<span className="text-xs font-medium">{label}</span>
1411
</div>
1512
)}

components/labeled-group-node.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,20 @@ import { BaseNode } from "@/components/base-node";
44
export function LabeledGroupNode({ id, data, selected }: any) {
55
const { label } = data;
66

7-
const controlStyle = {
8-
background: "transparent",
9-
border: "none",
10-
};
11-
127
return (
138
<BaseNode
149
selected={selected}
15-
className="h-full overflow-hidden rounded-sm p-0"
1610
style={{
1711
width: 600,
1812
height: 300,
1913
}}
2014
>
21-
<NodeResizeControl
22-
style={controlStyle}
23-
minWidth={400}
24-
minHeight={250}
25-
>
15+
<NodeResizeControl minWidth={400} minHeight={250}>
2616
<ResizeIcon />
2717
</NodeResizeControl>
2818
{label && (
2919
<div className="absolute -top-7 flex w-full items-end justify-between">
30-
<span className="text-sm font-bold text-primary">
31-
{label}
32-
</span>
20+
<span className="text-sm font-bold">{label}</span>
3321
</div>
3422
)}
3523
<Handle type="target" position={Position.Left} />

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy