refactor(examples): cleanup

This commit is contained in:
moklick
2020-07-27 12:36:47 +02:00
parent a436260a1c
commit cbc41f244e
4 changed files with 30 additions and 19 deletions
+10 -6
View File
@@ -10,6 +10,12 @@ const onLoad = (reactFlowInstance) => console.log('flow loaded:', reactFlowInsta
const initBgColor = '#f0e742';
const connectionLineStyle = { stroke: '#fff' };
const snapGrid = [16, 16];
const nodeTypes = {
selectorNode: ColorSelectorNode,
};
const CustomNodeFlow = () => {
const [elements, setElements] = useState([]);
const [bgColor, setBgColor] = useState(initBgColor);
@@ -66,14 +72,12 @@ const CustomNodeFlow = () => {
onElementsRemove={onElementsRemove}
onConnect={onConnect}
onNodeDragStop={onNodeDragStop}
style={{ width: '100%', height: '100%', background: bgColor }}
style={{ background: bgColor }}
onLoad={onLoad}
nodeTypes={{
selectorNode: ColorSelectorNode,
}}
connectionLineStyle={{ stroke: '#fff' }}
nodeTypes={nodeTypes}
connectionLineStyle={connectionLineStyle}
snapToGrid={true}
snapGrid={[16, 16]}
snapGrid={snapGrid}
>
<MiniMap
nodeColor={(n) => {