refactor(background): export background as component closes #235

This commit is contained in:
moklick
2020-05-25 15:53:56 +02:00
parent 10cd70c6ee
commit 7324c79fd0
24 changed files with 229 additions and 227 deletions
+7 -4
View File
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import ReactFlow, { removeElements, addEdge, MiniMap, Controls } from 'react-flow-renderer';
import ReactFlow, { removeElements, addEdge, MiniMap, Controls, Background } from 'react-flow-renderer';
const onNodeDragStart = node => console.log('drag start', node);
const onNodeDragStop = node => console.log('drag stop', node);
@@ -59,8 +59,6 @@ const OverviewFlow = () => {
onLoad={onLoad}
connectionLineStyle={{ stroke: '#ddd', strokeWidth: 2 }}
connectionLineType="bezier"
backgroundColor="#888"
backgroundGap={16}
snapToGrid={true}
snapGrid={[16, 16]}
>
@@ -74,11 +72,16 @@ const OverviewFlow = () => {
}}
/>
<Controls />
<Background
color="#888"
gap={16}
/>
<button
type="button"
onClick={addRandomNode}
style={{ position: 'absolute', right: 10, top: 30, zIndex: 4 }}
className="richexample__add"
className="overview-example__add"
>
add node
</button>