Skip to content

Commit e0755c1

Browse files
authored
chore(explain-plan): update tooltip message to match symbols (#4822)
1 parent 9c2af84 commit e0755c1

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

packages/compass-components/src/components/index-icon.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,29 @@ import Icon from '@leafygreen-ui/icon';
33

44
type IndexDirection = number | unknown;
55

6-
const IndexIcon = ({ direction }: { direction: IndexDirection }) => {
6+
const IndexIcon = ({
7+
className,
8+
direction,
9+
}: {
10+
className?: string;
11+
direction: IndexDirection;
12+
}) => {
713
return direction === 1 ? (
8-
<Icon glyph="ArrowUp" size="small" aria-label="Ascending index" />
14+
<Icon
15+
className={className}
16+
glyph="ArrowUp"
17+
size="small"
18+
aria-label="Ascending index"
19+
/>
920
) : direction === -1 ? (
10-
<Icon glyph="ArrowDown" size="small" aria-label="Descending index" />
21+
<Icon
22+
className={className}
23+
glyph="ArrowDown"
24+
size="small"
25+
aria-label="Descending index"
26+
/>
1127
) : (
12-
<span>({String(direction)})</span>
28+
<span className={className}>({String(direction)})</span>
1329
);
1430
};
1531

packages/compass-explain-plan/src/components/explain-plan-side-summary.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
useDarkMode,
1111
cx,
1212
IndexBadge,
13+
IndexIcon,
1314
Icon,
1415
SignalPopover,
1516
PerformanceSignals,
@@ -47,7 +48,7 @@ const ExplainPlanSummaryStat = <T extends string | boolean | number>({
4748
value?: T;
4849
formatter?: (val: T) => string;
4950
label: ReactNode;
50-
definition: string;
51+
definition: React.ReactNode;
5152
['data-testid']?: string;
5253
}): ReactElement | null => {
5354
return React.createElement(
@@ -126,6 +127,10 @@ const indexesSummaryStyles = css({
126127
gap: spacing[2],
127128
});
128129

130+
const indexIconDescriptionStyles = css({
131+
verticalAlign: 'text-top',
132+
});
133+
129134
export const ExplainPlanSummary: React.FunctionComponent<
130135
ExplainPlanSummaryProps
131136
> = ({
@@ -258,7 +263,21 @@ export const ExplainPlanSummary: React.FunctionComponent<
258263
<ExplainPlanSummaryStat
259264
as="div"
260265
label={indexMessageText}
261-
definition="The index(es) used to fulfill the query. A value of 1 indicates an ascending index, and a value of -1 indicates a descending index."
266+
definition={
267+
<>
268+
The index(es) used to fulfill the query. A value of{' '}
269+
<IndexIcon
270+
className={indexIconDescriptionStyles}
271+
direction={1}
272+
/>{' '}
273+
indicates an ascending index, and a value of{' '}
274+
<IndexIcon
275+
className={indexIconDescriptionStyles}
276+
direction={-1}
277+
/>{' '}
278+
indicates a descending index.
279+
</>
280+
}
262281
></ExplainPlanSummaryStat>
263282
{indexKeys.map(([field, value]) => {
264283
return (

0 commit comments

Comments
 (0)