Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmcc committed Feb 4, 2024
1 parent b597692 commit 4e8e43e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
23 changes: 12 additions & 11 deletions lib/NodeGraphEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ export const ExampleNodeGraphEditor = forwardRef<
>(({ nodes, edges, config: _config }: ExampleNodeGraphEditorProps, ref) => {
const config = useBuildGraphConfig(_config)
return (
<NodeGraphEditor
config={config}
ref={ref}
defaultNodes={nodes}
defaultEdges={edges}
colorMode="dark"
>
<Background color="#52525b" variant={BackgroundVariant.Dots} />
<MiniMap />
<Controls />
</NodeGraphEditor>
<NodeGraphEditor
config={config}
ref={ref}
defaultNodes={nodes}
defaultEdges={edges}
colorMode="dark"
>
<Background color="#52525b" variant={BackgroundVariant.Dots} />
<MiniMap />
<Controls />
</NodeGraphEditor>
)
})

Expand Down Expand Up @@ -165,6 +165,7 @@ const Flow = forwardRef<NodeGraphHandle, FlowProps>(
>
<ReactFlow
{...props}
colorMode={props.colorMode ?? 'dark'}
nodes={nodes}
edges={edges}
onNodesChange={onNodesChange}
Expand Down
14 changes: 8 additions & 6 deletions lib/NodeGraphEditorLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ const meta = {
const ref = useRef<NodeGraphHandle>(null)
return (
<div style={{ width: '100%', height: '100%' }}>
<button
style={{ position: 'absolute', top: 10, left: 10, zIndex: 1000 }}
onClick={() => ref.current!.layout()}
>
Layout
</button>
<div className="absolute top-3 left-3 z-10 space-x-3">
<button
className="bg-neutral-500 text-white px-4 rounded hover:bg-neutral-600"
onClick={() => ref.current!.layout()}
>
Layout
</button>
</div>
<ExampleNodeGraphEditor
ref={ref}
config={config}
Expand Down

0 comments on commit 4e8e43e

Please sign in to comment.