@@ -16,6 +16,10 @@ interface CheckInTooltipProps<Status extends string> extends Omit<TooltipProps,
16
16
* The tick that the tooltip is rendered for
17
17
*/
18
18
jobTick : JobTickData < Status > ;
19
+ /**
20
+ * A function which returns the unit for the row given the count of check-ins.
21
+ */
22
+ makeUnit : ( count : number ) => React . ReactNode ;
19
23
/**
20
24
* Maps the job tick status to a human readable label
21
25
*/
@@ -33,6 +37,7 @@ export function CheckInTooltip<Status extends string>({
33
37
statusStyle,
34
38
statusLabel,
35
39
children,
40
+ makeUnit,
36
41
...props
37
42
} : CheckInTooltipProps < Status > ) {
38
43
const { startTs, endTs, stats} = jobTick ;
@@ -56,6 +61,7 @@ export function CheckInTooltip<Status extends string>({
56
61
< tr >
57
62
< td > { t ( 'Status' ) } </ td >
58
63
< td > { t ( 'Count' ) } </ td >
64
+ < td > { t ( 'Unit' ) } </ td >
59
65
</ tr >
60
66
</ thead >
61
67
< tbody >
@@ -67,6 +73,7 @@ export function CheckInTooltip<Status extends string>({
67
73
{ statusLabel [ status ] }
68
74
</ StatusLabel >
69
75
< StatusCount > { count } </ StatusCount >
76
+ < StatusUnit > { makeUnit ( count ) } </ StatusUnit >
70
77
</ tr >
71
78
)
72
79
) }
@@ -86,7 +93,7 @@ const StatusCountContainer = styled('table')`
86
93
width: 100%;
87
94
margin: 0;
88
95
display: grid;
89
- grid-template-columns: max-content max-content;
96
+ grid-template-columns: max-content max-content max-content ;
90
97
gap: ${ space ( 1 ) } ;
91
98
92
99
/* Visually hide the tooltip headers but keep them for accessability */
@@ -106,6 +113,10 @@ const StatusCountContainer = styled('table')`
106
113
grid-column: 1 / -1;
107
114
grid-template-columns: subgrid;
108
115
}
116
+
117
+ td {
118
+ text-align: left;
119
+ }
109
120
` ;
110
121
111
122
const TooltipTimeLabel = styled ( 'div' ) `
@@ -115,10 +126,12 @@ const TooltipTimeLabel = styled('div')`
115
126
116
127
const StatusLabel = styled ( 'td' ) < { labelColor : ColorOrAlias } > `
117
128
color: ${ p => p . theme [ p . labelColor ] } ;
118
- text-align: left;
119
129
` ;
120
130
121
131
const StatusCount = styled ( 'td' ) `
122
132
font-variant-numeric: tabular-nums;
123
- text-align: left;
133
+ ` ;
134
+
135
+ const StatusUnit = styled ( 'td' ) `
136
+ color: ${ p => p . theme . subText } ;
124
137
` ;
0 commit comments