refactor(background): export background as component closes #235
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Node } from '../../types';
|
||||
|
||||
interface MiniMapNodeProps {
|
||||
node: Node;
|
||||
color: string;
|
||||
borderRadius: number;
|
||||
}
|
||||
|
||||
const MiniMapNode = ({ node, color, borderRadius }: MiniMapNodeProps) => {
|
||||
const {
|
||||
position: { x, y },
|
||||
width,
|
||||
height,
|
||||
} = node.__rg;
|
||||
const { background, backgroundColor } = node.style || {};
|
||||
const fill = (background || backgroundColor || color) as string;
|
||||
return (
|
||||
<rect
|
||||
className="react-flow__minimap-node"
|
||||
x={x}
|
||||
y={y}
|
||||
rx={borderRadius}
|
||||
ry={borderRadius}
|
||||
width={width}
|
||||
height={height}
|
||||
fill={fill}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
MiniMapNode.displayName = 'MiniMapNode';
|
||||
|
||||
export default MiniMapNode;
|
||||
Reference in New Issue
Block a user