Skip to content

Commit e1f0f8c

Browse files
Merge pull request #170 from festim-dev/highligh-node
Highlight node
2 parents 920fe5a + 14c59a7 commit e1f0f8c

File tree

4 files changed

+60
-30
lines changed

4 files changed

+60
-30
lines changed

src/components/nodes/AmplifierNode.jsx

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,38 @@ export function AmplifierNode({ data }) {
66
<div
77
style={{
88
width: 90,
9-
height: 80,
9+
height: 60,
10+
background: data.nodeColor || '#DDE6ED',
1011
color: 'black',
12+
borderRadius: 8,
13+
padding: 8,
1114
fontWeight: 'bold',
1215
position: 'relative',
1316
cursor: 'pointer',
17+
display: 'flex',
18+
flexDirection: 'column',
19+
alignItems: 'center',
20+
justifyContent: 'center',
1421
}}
1522
>
16-
17-
<svg width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="none">
18-
<polygon points="0,0 100,50 0,100" fill={data.nodeColor || "#DDE6ED"} />
19-
</svg>
23+
{/* Amplifier symbol */}
2024
<div style={{
21-
fontSize: '12px',
22-
textAlign: 'center',
23-
background: 'transparent',
24-
transform: 'translate(-80%, -50%)',
25-
top: '50%',
26-
left: '50%',
27-
position: 'absolute',
25+
fontSize: '16px',
26+
fontWeight: 'bold',
27+
marginBottom: '2px',
2828
}}>
29-
{data.label}
29+
×{data.gain || 'K'}
3030
</div>
31-
31+
32+
{/* Optional label */}
33+
{data.label && (
34+
<div style={{
35+
fontSize: '10px',
36+
textAlign: 'center',
37+
}}>
38+
{data.label}
39+
</div>
40+
)}
3241

3342
<Handle type="target" position="left" style={{ background: '#555' }} />
3443
<Handle type="source" position="right" style={{ background: '#555' }} />
@@ -41,29 +50,38 @@ export function AmplifierNodeReverse({ data }) {
4150
<div
4251
style={{
4352
width: 90,
44-
height: 80,
53+
height: 60,
54+
background: data.nodeColor || '#DDE6ED',
4555
color: 'black',
56+
borderRadius: 8,
57+
padding: 8,
4658
fontWeight: 'bold',
4759
position: 'relative',
4860
cursor: 'pointer',
61+
display: 'flex',
62+
flexDirection: 'column',
63+
alignItems: 'center',
64+
justifyContent: 'center',
4965
}}
5066
>
51-
52-
<svg width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="none">
53-
<polygon points="0,50 100,100 100,0" fill={data.nodeColor || "#DDE6ED"} />
54-
</svg>
67+
{/* Amplifier symbol with reverse indicator */}
5568
<div style={{
56-
fontSize: '12px',
57-
textAlign: 'center',
58-
background: 'transparent',
59-
transform: 'translate(-50%, -50%)',
60-
top: '50%',
61-
left: '50%',
62-
position: 'absolute',
69+
fontSize: '16px',
70+
fontWeight: 'bold',
71+
marginBottom: '2px',
6372
}}>
64-
{data.label}
73+
×{data.gain || 'K'}
6574
</div>
66-
75+
76+
{/* Optional label */}
77+
{data.label && (
78+
<div style={{
79+
fontSize: '10px',
80+
textAlign: 'center',
81+
}}>
82+
{data.label}
83+
</div>
84+
)}
6785

6886
<Handle type="target" position="right" style={{ background: '#555' }} />
6987
<Handle type="source" position="left" style={{ background: '#555' }} />

src/components/nodes/DefaultNode.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function DefaultNode({ data }) {
88
width: 180,
99
background: data.nodeColor || '#DDE6ED',
1010
color: 'black',
11-
borderRadius: 0,
11+
borderRadius: 8,
1212
padding: 10,
1313
fontWeight: 'bold',
1414
position: 'relative',

src/components/nodes/IntegratorNode.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function IntegratorNode({ data }) {
1212
width: 180,
1313
background: data.nodeColor || '#DDE6ED',
1414
color: 'black',
15-
borderRadius: 0,
15+
borderRadius: 8,
1616
padding: 10,
1717
fontWeight: 'bold',
1818
position: 'relative',

src/styles/App.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
background-color: #0056b3 !important;
1515
}
1616

17+
/* Node hover effects */
18+
.react-flow__node:hover > div {
19+
border: 2px solid #78A083 !important;
20+
box-shadow: 0 0 8px #78a08366;
21+
}
22+
23+
/* Default border for divs */
24+
.react-flow__node > div {
25+
border: 2px solid #ccc !important;
26+
}
27+
28+
1729
/* App container */
1830
.app {
1931
width: 100vw;

0 commit comments

Comments
 (0)