Skip to content

Commit

Permalink
fix progress bar text alignment and missing translations (metabase#19249
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alxnddr authored Dec 7, 2021
1 parent 411e69e commit a21b5f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { t } from "ttag";
import { scaleLinear } from "@visx/scale";
import { Group } from "@visx/group";
import { ClipPath } from "@visx/clip-path";
Expand Down Expand Up @@ -111,7 +112,7 @@ const ProgressBar = ({
color="white"
x={layout.iconSize + 16}
y={layout.barHeight / 2}
dominantBaseline="central"
verticalAnchor="middle"
fill="white"
>
{barText}
Expand Down Expand Up @@ -144,7 +145,7 @@ const ProgressBar = ({
{formatNumber(0, format)}
</Text>
<Text fontSize={layout.fontSize} textAnchor="end" x={xMax}>
{`Goal ${formatNumber(data.goal, format)}`}
{t`Goal ${formatNumber(data.goal, format)}`}
</Text>
</Group>
</svg>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Color from "color";
import { t } from "ttag";
import { measureText } from "metabase/static-viz/lib/text";
import { ProgressBarData } from "./types";

Expand Down Expand Up @@ -31,9 +32,9 @@ export const getColors = (

export const getBarText = ({ value, goal }: ProgressBarData) => {
if (value === goal) {
return "Goal met";
return t`Goal met`;
} else if (value > goal) {
return "Goal exceeded";
return t`Goal exceeded`;
}

return null;
Expand Down

0 comments on commit a21b5f0

Please sign in to comment.