mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 10:41:14 +00:00
- May give the feeling something is not there when it should be, or incomplete. - They create visual noise
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import _ from 'lodash';
|
|
|
|
function dissoc(obj, key) {
|
|
const newObj = _.clone(obj);
|
|
delete newObj[key];
|
|
return newObj;
|
|
}
|
|
|
|
export default function NodeShapeStack(props) {
|
|
const propsNoHighlight = dissoc(props, 'highlighted');
|
|
const propsOnlyHighlight = Object.assign({}, props, {onlyHighlight: true});
|
|
|
|
const Shape = props.shape;
|
|
const [dx, dy] = [0, 6];
|
|
const ds = 0.075;
|
|
const dsx = (props.size * 2 + dx) / (props.size * 2);
|
|
const dsy = (props.size * 2 + dy) / (props.size * 2);
|
|
const hls = [dsx, dsy];
|
|
|
|
return (
|
|
<g transform={`translate(${dx * -1}, ${dy * -1})`} className="stack">
|
|
<g transform={`translate(${dx * 2}, ${dy * 2}) scale(${1 - (2 * ds)}, ${1 - (2 * ds)})`}>
|
|
<Shape {...propsNoHighlight} />
|
|
</g>
|
|
<g transform={`translate(${dx * 1}, ${dy * 1}) scale(${1 - (1 * ds)}, ${1 - (1 * ds)})`}>
|
|
<Shape {...propsNoHighlight} />
|
|
</g>
|
|
<g transform={`translate(${dx * 0.5}, ${dy * 0.5}) scale(${hls})`} className="stack">
|
|
<Shape {...propsOnlyHighlight} />
|
|
</g>
|
|
<Shape {...propsNoHighlight} />
|
|
</g>
|
|
);
|
|
}
|