import React, { FC, useCallback, useEffect, useState } from "react"; import { Background, BackgroundVariant, Elements } from "react-flow-renderer"; import { Meta, StoryFn } from "@storybook/react"; import { Default as ReactFlowExample } from "../../../cmem/react-flow/ReactFlow/ReactFlow.stories"; import { ApplicationContainer, MiniMap, MiniMapProps, ReactFlowExtended } from "./../../../index"; export default { title: "Extensions/React Flow/MiniMap", component: MiniMap, argTypes: {}, } as Meta; const MiniMapExample: FC = (args) => { const [reactflowInstance, setReactflowInstance] = useState(undefined); const [elements, setElements] = useState([] as Elements); const nodeExamples = ReactFlowExample.nodeExamples.workflow; useEffect(() => { setElements([...nodeExamples.nodes, ...nodeExamples.edges] as Elements); }, [args]); const onLoad = useCallback((rfi) => { if (!reactflowInstance) { setReactflowInstance(rfi); } }, []); return ( ); }; let forcedUpdateKey = 0; // @see https://github.com/storybookjs/storybook/issues/13375#issuecomment-1291011856 const Template: StoryFn = (args) => ; export const Default = Template.bind({}); Default.args = { enableNavigation: true, wrapperProps: { "data-test-id": "minimap-test-id", "data-testid": "minimap-testid", }, };