From 91eac6e7afb657e72582e17ce8438cd3dff2b5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 10 Nov 2020 15:38:25 +0100 Subject: [PATCH] StatPanel: Fixed center of values in edge case scenarios (#28968) --- .../grafana-ui/src/components/BigValue/BigValueLayout.tsx | 4 ++++ .../components/BigValue/__snapshots__/BigValue.test.tsx.snap | 1 + 2 files changed, 5 insertions(+) diff --git a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx index 95eea803376..8ec540bee55 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx @@ -67,6 +67,10 @@ export abstract class BigValueLayout { zIndex: 1, }; + if (this.justifyCenter) { + styles.textAlign = 'center'; + } + switch (this.props.colorMode) { case BigValueColorMode.Value: styles.color = this.valueColor; diff --git a/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap b/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap index 3f57fd43340..1a370a23628 100644 --- a/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap +++ b/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap @@ -35,6 +35,7 @@ exports[`BigValue Render with basic options should render 1`] = ` "fontWeight": 500, "lineHeight": 1.2, "position": "relative", + "textAlign": "center", "zIndex": 1, } }