From 2acc5b7706de1f52d87323989d27c9e04bd21577 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Thu, 9 Mar 2023 14:46:46 +0000 Subject: [PATCH] :recycle: Rename 'MiniMapNode' prop to 'nodeComponent' for greater consistency. --- packages/minimap/src/MiniMap.tsx | 8 ++++---- packages/minimap/src/types.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/minimap/src/MiniMap.tsx b/packages/minimap/src/MiniMap.tsx index 378ee4f6..b4bc9ee2 100644 --- a/packages/minimap/src/MiniMap.tsx +++ b/packages/minimap/src/MiniMap.tsx @@ -55,6 +55,9 @@ function MiniMap({ nodeClassName = '', nodeBorderRadius = 5, nodeStrokeWidth = 2, + // We need to rename the prop to be `CapitalCase` so that JSX will render it as + // a component properly. + nodeComponent: NodeComponent = MiniMapNode, maskColor = 'rgb(240, 240, 240, 0.6)', maskStrokeColor = 'none', maskStrokeWidth = 1, @@ -64,9 +67,6 @@ function MiniMap({ pannable = false, zoomable = false, ariaLabel = 'React Flow mini map', - // Rename the field to avoid clashes with the default `MiniMapNode` component. - // Fallback to that component if none is provided. - MiniMapNode: CustomMiniMapNode = MiniMapNode, }: MiniMapProps) { const store = useStoreApi(); const svg = useRef(null); @@ -179,7 +179,7 @@ function MiniMap({ const { x, y } = getNodePositionWithOrigin(node, nodeOrigin).positionAbsolute; return ( - = Omit, ' nodeClassName?: string | GetMiniMapNodeAttribute; nodeBorderRadius?: number; nodeStrokeWidth?: number; + nodeComponent?: ComponentType; maskColor?: string; maskStrokeColor?: string; maskStrokeWidth?: number; @@ -19,7 +20,6 @@ export type MiniMapProps = Omit, ' pannable?: boolean; zoomable?: boolean; ariaLabel?: string | null; - MiniMapNode?: ComponentType; }; export interface MiniMapNodeProps {