set up of react flow done, example of custom node created, not typed

This commit is contained in:
anovazzi1 2023-02-08 23:24:25 -03:00
commit 1cc5a31127
4 changed files with 75 additions and 3 deletions

View file

@ -0,0 +1,28 @@
import { useCallback } from 'react';
import { Handle, Position } from 'reactflow';
const handleStyle = {left:10};
export default function TextUpdaterNode({data})
{
const onChange = useCallback((evt)=>{
console.log(evt.target.value)
},[])
return (
<div className="text-updater-node">
<Handle type='target' position={Position.Top}/>
<div>
<label htmlFor='text'>Text:</label>
<input id="text" name="text" onChange={onChange}></input>
</div>
<Handle type='source' id='a' position={Position.Bottom} style={handleStyle}/>
<Handle type='source' id='b' position={Position.Bottom}/>
</div>
)
}

View file

@ -0,0 +1,14 @@
.text-updater-node {
height: 50px;
border: 1px solid black;
padding: 5px;
border-radius: 5px;
background: white;
}
.text-updater-node label {
display: block;
color: #777;
font-size: 12px;
}