Files
weave-scope/client/app/scripts/charts/node-shape-square.js
Simon Howe a34d9c97b8 Adds node-shapes to the canvas
- circle
- rect (w/ radius)
- fluffy cloud shape
- hexagons
- stacks
2016-02-22 12:42:36 +01:00

25 lines
659 B
JavaScript

import React from 'react';
export default function NodeShapeSquare({highlighted, size, color, rx = 0, ry = 0}) {
const rectProps = (v) => {
return {
width: v * size * 2,
height: v * size * 2,
rx: v * size * rx,
ry: v * size * ry,
transform: `translate(-${size * v}, -${size * v})`
};
};
return (
<g className="shape">
{highlighted &&
<rect className="highlighted" {...rectProps(0.7)} />}
<rect className="border" stroke={color} {...rectProps(0.5)} />
<rect className="shadow" {...rectProps(0.45)} />
<circle className="node" r={Math.max(2, (size * 0.125))} />
</g>
);
}