passing function to node
This commit is contained in:
parent
84d8909782
commit
39643dba22
3 changed files with 4 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ import { Handle, Position } from "reactflow";
|
|||
export default function ModelNode({ data }) {
|
||||
console.log(data)
|
||||
return (
|
||||
<div className="model-Node relative bg-white h-16 w-40 border rounded-sm solid border-black flex flex-col justify-center">
|
||||
<div onClick={data.delete} className="model-Node relative bg-white h-16 w-40 border rounded-sm solid border-black flex flex-col justify-center">
|
||||
<Handle type="source" position={Position.Left}></Handle>
|
||||
<label className="absolute cursor-grab text-sm -top-3 left-1 bg-white w-14 text-center">
|
||||
Model
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ export function Sidebar(){
|
|||
|
||||
return(
|
||||
<div className="h-full w-48 bg-slate-200 flex flex-col">
|
||||
<div className="w-full text-center border border-black cursor-grab" onDragStart={(event)=>onDragStart(event,'promptNode')}> prompt Node</div>
|
||||
<div className="w-full text-center border border-black cursor-grab" onDragStart={(event)=>onDragStart(event,'modelNode')}> Model Node</div>
|
||||
<div className="w-full text-center border border-black cursor-grab" draggable onDragStart={(event)=>onDragStart(event,'promptNode')}> prompt Node</div>
|
||||
<div draggable className="w-full text-center border border-black cursor-grab" onDragStart={(event)=>onDragStart(event,'modelNode')}> Model Node</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ export default function Flow(){
|
|||
id:getId(),
|
||||
type,
|
||||
position,
|
||||
data
|
||||
data:{...data,delete:()=>console.log("asdsdsadad")}
|
||||
}
|
||||
setNodes((nds)=>nds.concat(newNode))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue