Gracefully remove information from squares. (#29083) (#29159)

This commit is contained in:
Sonja Krause-Harder 2019-01-23 11:40:53 +01:00 committed by GitHub
parent 1ff50b2fc0
commit 24ecb90a51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,8 @@ export class Node extends React.PureComponent<Props, State> {
const { nodeType, node, options, squareSize, bounds, formatter, timeRange } = this.props;
const { isPopoverOpen } = this.state;
const { metric } = node;
const valueMode = squareSize > 110;
const valueMode = squareSize > 70;
const ellipsisMode = squareSize > 30;
const rawValue = (metric && metric.value) || 0;
const color = colorFromValue(options.legend, rawValue, bounds);
const value = formatter(rawValue);
@ -64,11 +65,17 @@ export class Node extends React.PureComponent<Props, State> {
>
<SquareOuter color={color}>
<SquareInner color={color}>
{valueMode && (
{valueMode ? (
<ValueInner>
<Label color={color}>{node.name}</Label>
<Value color={color}>{value}</Value>
</ValueInner>
) : (
ellipsisMode && (
<ValueInner>
<Label color={color}>...</Label>
</ValueInner>
)
)}
</SquareInner>
</SquareOuter>