From 083991fe2a769fae924208784fcb817b83bd5ec6 Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 8 Feb 2021 11:49:52 +0100 Subject: [PATCH] feat(minimap): add nodeStrokeWidth option closes #862 --- .../MiniMap/MiniMapNode.tsx | 16 ++++++++++++++-- src/additional-components/MiniMap/index.tsx | 3 +++ src/style.css | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/additional-components/MiniMap/MiniMapNode.tsx b/src/additional-components/MiniMap/MiniMapNode.tsx index 618c6135..e2159328 100644 --- a/src/additional-components/MiniMap/MiniMapNode.tsx +++ b/src/additional-components/MiniMap/MiniMapNode.tsx @@ -10,10 +10,22 @@ interface MiniMapNodeProps { className: string; color: string; strokeColor: string; + strokeWidth: number; style?: CSSProperties; } -const MiniMapNode = ({ x, y, width, height, style, color, strokeColor, className, borderRadius }: MiniMapNodeProps) => { +const MiniMapNode = ({ + x, + y, + width, + height, + style, + color, + strokeColor, + strokeWidth, + className, + borderRadius, +}: MiniMapNodeProps) => { const { background, backgroundColor } = style || {}; const fill = (color || background || backgroundColor) as string; @@ -28,7 +40,7 @@ const MiniMapNode = ({ x, y, width, height, style, color, strokeColor, className height={height} fill={fill} stroke={strokeColor} - strokeWidth={2} + strokeWidth={strokeWidth} /> ); }; diff --git a/src/additional-components/MiniMap/index.tsx b/src/additional-components/MiniMap/index.tsx index a23abf7c..0a810a44 100644 --- a/src/additional-components/MiniMap/index.tsx +++ b/src/additional-components/MiniMap/index.tsx @@ -13,6 +13,7 @@ export interface MiniMapProps extends React.HTMLAttributes { nodeStrokeColor?: string | StringFunc; nodeClassName?: string | StringFunc; nodeBorderRadius?: number; + nodeStrokeWidth?: number; maskColor?: string; } @@ -26,6 +27,7 @@ const MiniMap = ({ nodeColor = '#fff', nodeClassName = '', nodeBorderRadius = 5, + nodeStrokeWidth = 2, maskColor = 'rgb(240, 242, 243, 0.7)', }: MiniMapProps) => { const containerWidth = useStoreState((s) => s.width); @@ -83,6 +85,7 @@ const MiniMap = ({ color={nodeColorFunc(node)} borderRadius={nodeBorderRadius} strokeColor={nodeStrokeColorFunc(node)} + strokeWidth={nodeStrokeWidth} /> ))}