Skip to content

Commit 58a95df

Browse files
committed
polish styles
1 parent a2f7cf6 commit 58a95df

4 files changed

Lines changed: 31 additions & 30 deletions

File tree

src/controls/KPIControl/KpiCard.tsx

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const KPICard: React.FunctionComponent<IKpiCardProps> = (
4343
const isOnTrack = React.useMemo(
4444
() =>
4545
dataCard.goalMetric === EGoalMetric.LOWER_IS_BETTER
46-
? dataCard.currentValue <= dataCard.goal // Lower is better: on track when current <= goal
46+
? dataCard.currentValue <= dataCard.goal // Lower is better: on track when current <= goal
4747
: dataCard.currentValue >= dataCard.goal, // Higher is better: on track when current >= goal
4848
[dataCard.currentValue, dataCard.goal, dataCard.goalMetric],
4949
);
@@ -61,7 +61,7 @@ export const KPICard: React.FunctionComponent<IKpiCardProps> = (
6161
[dataCard.currentValue, dataCard.totalItems],
6262
);
6363

64-
// Success / Danger foregrounds (icon + badge text + bar fill)
64+
// Success / Danger foregrounds
6565
const accentFg = React.useMemo(
6666
() =>
6767
isOnTrack
@@ -120,7 +120,8 @@ export const KPICard: React.FunctionComponent<IKpiCardProps> = (
120120
infoButton={{
121121
popover: {
122122
open: isInfoLabelOpen,
123-
onOpenChange: (_e, data) => setIsInfoLabelOpen(data.open),
123+
onOpenChange: (_e, data) =>
124+
setIsInfoLabelOpen(data.open),
124125
},
125126
}}
126127
info={
@@ -211,57 +212,47 @@ export const KPICard: React.FunctionComponent<IKpiCardProps> = (
211212
content={strings.KPIMaxAllowedThreshold}
212213
relationship="inaccessible"
213214
>
214-
<Text className={styles.footerMetric}>
215+
<Stack alignItems="center" gap={tokens.spacingVerticalXXS}>
215216
<TargetRegular className={styles.footerIcon} />
216217
<Text className={styles.footerLabel}>Goal</Text>
217218
<Text className={styles.footerValue}>{goal}</Text>
218-
</Text>
219+
</Stack>
219220
</Tooltip>
220221

221-
<Divider
222-
vertical
223-
style={{
224-
height: '32px',
225-
borderColor: tokens.colorNeutralStroke1, // token border
226-
}}
227-
/>
222+
<Divider vertical className={styles.footerDivider} />
228223

229224
{/* Total Items */}
230225
<Tooltip
231226
content={strings.KPITotalItemsInScope}
232227
relationship="inaccessible"
233228
>
234-
<Text className={styles.footerMetric}>
229+
<Stack alignItems="center" gap={tokens.spacingVerticalXXS}>
235230
<DocumentRegular className={styles.footerIcon} />
236231
<Text className={styles.footerLabel}>
237232
{strings.KPITotalItems}
238233
</Text>
239234
<Text className={styles.footerValue}>
240235
{dataCard.totalItems.toLocaleString()}
241236
</Text>
242-
</Text>
237+
</Stack>
243238
</Tooltip>
244239

245-
<Divider
246-
vertical
247-
style={{
248-
height: '32px',
249-
borderColor: tokens.colorNeutralStroke1,
250-
}}
251-
/>
240+
<Divider vertical className={styles.footerDivider} />
252241

253242
{/* % of Total */}
254243
<Tooltip
255244
content={strings.KPICurrentValueAsPercent}
256245
relationship="inaccessible"
257246
>
258-
<Text className={styles.footerMetric}>
247+
<Stack alignItems="center" gap={tokens.spacingVerticalXXS}>
259248
<CalculatorRegular className={styles.footerIcon} />
260-
<Text className={styles.footerLabel}>{strings.KPIPercentOfTotal}</Text>
249+
<Text className={styles.footerLabel}>
250+
{strings.KPIPercentOfTotal}
251+
</Text>
261252
<Text className={styles.footerValue}>
262253
{totalPercent.toFixed(2)}%
263254
</Text>
264-
</Text>
255+
</Stack>
265256
</Tooltip>
266257
</CardFooter>
267258
<Stack>

src/controls/KPIControl/KpiCardCompact.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const KPICardCompact: React.FunctionComponent<IKpiCardProps> = (
4848
[isOnTrack],
4949
);
5050

51-
// Success / Danger foregrounds (icon + badge text + bar fill)
51+
// Success / Danger foregrounds
5252
const accentFg = React.useMemo(
5353
() =>
5454
isOnTrack
@@ -57,11 +57,6 @@ export const KPICardCompact: React.FunctionComponent<IKpiCardProps> = (
5757
[isOnTrack],
5858
);
5959

60-
// Success / Danger backgrounds (badge pill bg)
61-
62-
// Success / Danger borders (badge pill border)
63-
64-
6560
return (
6661
<>
6762
<Card className={styles.card} style={{ height: '168px' }} onMouseLeave={handleCardMouseLeave}>

src/controls/KPIControl/useKpiStyles.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface IKpiStyles {
2222
footerIcon: string;
2323
footerLabel: string;
2424
footerValue: string;
25+
footerDivider: string;
2526
glowBlob: string;
2627
glowBlobSuccess: string;
2728
glowBlobError: string;
@@ -42,6 +43,7 @@ interface IKpiStyles {
4243
noKpiButtonContainer: string;
4344
noKpiButton: string;
4445
noKpiDecorativeLine: string;
46+
footerGrid: string;
4547
}
4648

4749
export const useKpiStyles = (): IKpiStyles => {
@@ -92,6 +94,10 @@ export const useKpiStyles = (): IKpiStyles => {
9294
fontWeight: tokens.fontWeightSemibold,
9395
color: tokens.colorNeutralForeground2,
9496
}),
97+
footerDivider: css({
98+
height: "32px",
99+
borderColor: tokens.colorNeutralStroke1,
100+
}),
95101
glowBlob: css({
96102
position: "absolute",
97103
top: "-60px",
@@ -292,6 +298,14 @@ export const useKpiStyles = (): IKpiStyles => {
292298
position: "relative",
293299
zIndex: 1,
294300
}),
301+
footerGrid: css({
302+
width: "100%",
303+
display: "grid",
304+
gridTemplateColumns: "repeat(auto-fit, minmax(80px, 1fr))",
305+
306+
alignItems: "center",
307+
308+
}),
295309
};
296310
return styles;
297311
};

src/loc/en-us.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ KPIPercentOfTotal: "% of Total",
487487
KPIProgressGoal: "Progress Goal",
488488
KPISucess: "success",
489489
KPITotalItemsInScope: "Total items in scope",
490+
KPITotalItems: "Items",
490491
KPIWithinGoalThreshold: "Within goal threshold",
491492
worldMapCoord: "Coord:",
492493
worldMapE: "° E",

0 commit comments

Comments
 (0)