tiny updates to internal library examples

This commit is contained in:
peterkogo
2024-06-17 11:57:15 +02:00
parent e6b21d372e
commit 42f4f59425
3 changed files with 14 additions and 1 deletions
@@ -25,6 +25,7 @@ const defaultNodes: Node[] = [
}, },
{ {
id: '3', id: '3',
type: 'output',
data: { label: 'Node 3' }, data: { label: 'Node 3' },
position: { x: 400, y: 100 }, position: { x: 400, y: 100 },
className: 'light', className: 'light',
@@ -28,6 +28,14 @@ const initialNodes: Node[] = [
data: { label: 'A Node' }, data: { label: 'A Node' },
position: { x: 250, y: 0 }, position: { x: 250, y: 0 },
}, },
{
id: '3',
type: 'b',
sourcePosition: Position.Right,
targetPosition: Position.Left,
data: { label: 'B Node' },
position: { x: 350, y: 0 },
},
]; ];
const buttonStyle: CSSProperties = { const buttonStyle: CSSProperties = {
@@ -78,6 +86,7 @@ const NodeTypeChangeFlow = () => {
onEdgesChange={onEdgesChange} onEdgesChange={onEdgesChange}
onConnect={onConnect} onConnect={onConnect}
nodeTypes={nodeTypesObjects[nodeTypesId]} nodeTypes={nodeTypesObjects[nodeTypesId]}
fitView
> >
<button onClick={changeType} style={buttonStyle}> <button onClick={changeType} style={buttonStyle}>
change type change type
@@ -1,9 +1,12 @@
import { useKeyPress } from '@xyflow/react'; import { useKeyPress } from '@xyflow/react';
import { useEffect } from 'react';
const UseKeyPressComponent = () => { const UseKeyPressComponent = () => {
const metaPressed = useKeyPress(['Meta']); const metaPressed = useKeyPress(['Meta']);
console.log({ metaPressed }); useEffect(() => {
console.log({ metaPressed });
}, [metaPressed]);
return <div />; return <div />;
}; };