Skip to content

Commit 2b30e9b

Browse files
committed
Move the annotation next to the goal when there isn't HI data
1 parent 8ff83fd commit 2b30e9b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/components/Dashboard/MonthlyGoal/MonthlyGoal.tsx

+15-15
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ const MonthlyGoal = ({
159159
}
160160
: null;
161161
const annotationId = useId();
162+
const annotationNode = annotation && (
163+
<Typography
164+
id={annotationId}
165+
color={annotation.warning ? 'statusWarning.main' : 'textSecondary'}
166+
variant="body2"
167+
>
168+
<span aria-hidden>*</span>
169+
{annotation.label}
170+
</Typography>
171+
);
162172

163173
return (
164174
<>
@@ -250,6 +260,8 @@ const MonthlyGoal = ({
250260
</>
251261
)}
252262
</Typography>
263+
{/* Without the HI card there is enough space for the annotation so display it here */}
264+
{annotation && !showHealthIndicator && annotationNode}
253265
{annotation?.warning && (
254266
<Button
255267
component={NextLink}
@@ -379,22 +391,10 @@ const MonthlyGoal = ({
379391
</Grid>
380392
)}
381393
</Hidden>
382-
{annotation && (
394+
{/* With the HI card there isn't enough space for the annotation next to the monthly goal so display it here */}
395+
{annotation && showHealthIndicator && (
383396
<Hidden smDown>
384-
<Grid item>
385-
<Typography
386-
id={annotationId}
387-
color={
388-
annotation.warning
389-
? 'statusWarning.main'
390-
: 'textSecondary'
391-
}
392-
variant="body2"
393-
>
394-
<span aria-hidden>*</span>
395-
{annotation.label}
396-
</Typography>
397-
</Grid>
397+
<Grid item>{annotationNode}</Grid>
398398
</Hidden>
399399
)}
400400
</Grid>

0 commit comments

Comments
 (0)