Files
weave-scope/client/app/scripts/charts/node-shape-stack.js
Simon Howe dc61317ba5 Bring shapes into the details panel and use them for view-in-topo
(click on shape/title to view it in its topo)
2016-11-03 11:10:07 +01:00

27 lines
893 B
JavaScript

import React from 'react';
import { isContrastMode } from '../utils/contrast-utils';
export default function NodeShapeStack(props) {
const contrastMode = isContrastMode();
const Shape = props.shape;
const [dx, dy] = contrastMode ? [0, 8] : [0, 5];
const dsx = (props.size * 2 + (dx * 2)) / (props.size * 2);
const dsy = (props.size * 2 + (dy * 2)) / (props.size * 2);
const hls = [dsx, dsy];
return (
<g transform={`translate(${dx * -1}, ${dy * -2.5})`} className="stack">
<g transform={`scale(${hls})translate(${dx}, ${dy})`} className="onlyHighlight">
<Shape {...props} />
</g>
<g className="noNode" transform={`translate(${dx * 2}, ${dy * 2})`}>
<Shape {...props} />
</g>
<g className="noNode" transform={`translate(${dx * 1}, ${dy * 1})`}>
<Shape {...props} />
</g>
<Shape {...props} />
</g>
);
}