Skip to content

Commit fdb33a7

Browse files
committed
refactor(annotator search): add tooltip for shortcuts on prev and next occurrence
1 parent 97bc748 commit fdb33a7

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

packages/client/src/components/advanced/Annotator/AnnotatorSearchLine/AnnotatorSearchLine.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -432,19 +432,31 @@ export const AnnotatorSearchLine: React.FC<AnnotatorSearchLine> = ({
432432
{searchActiveOccurence + 1} of {searchOccurences.length}
433433
</div>
434434
<div style={{ display: "flex", gap: "0.5rem" }}>
435-
<FaRegArrowAltCircleUp
436-
size={15}
437-
color={theme.color.info}
438-
style={{ cursor: "pointer" }}
439-
title="previous occurence"
440-
onClick={goToPreviousOccurence}
435+
<IconWithTooltip
436+
icon={
437+
<FaRegArrowAltCircleUp
438+
size={15}
439+
color={theme.color.info}
440+
style={{ cursor: "pointer" }}
441+
onClick={goToPreviousOccurence}
442+
/>
443+
}
444+
tooltipLabel="previous occurence"
445+
tooltipText="(Shift + F3)"
446+
tooltipPosition="top"
441447
/>
442-
<FaRegArrowAltCircleDown
443-
size={15}
444-
color={theme.color.info}
445-
style={{ cursor: "pointer" }}
446-
title="next occurence"
447-
onClick={goToNextOccurence}
448+
<IconWithTooltip
449+
icon={
450+
<FaRegArrowAltCircleDown
451+
size={15}
452+
color={theme.color.info}
453+
style={{ cursor: "pointer" }}
454+
onClick={goToNextOccurence}
455+
/>
456+
}
457+
tooltipLabel="next occurence"
458+
tooltipText="(F3)"
459+
tooltipPosition="top"
448460
/>
449461
</div>
450462
</>

packages/client/src/components/basic/IconWithTooltip/IconWithTooltip.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ interface IconWithTooltip {
1414
tooltipPosition?: AutoPlacement | BasePlacement | VariationPlacement;
1515
color?: keyof ThemeColor;
1616
fullWidth?: boolean;
17+
tooltipText?: string;
1718
}
1819
export const IconWithTooltip: React.FC<IconWithTooltip> = ({
1920
icon,
2021
tooltipLabel,
2122
tooltipPosition = "bottom",
2223
color = "black",
2324
fullWidth = false,
25+
tooltipText,
2426
}) => {
2527
const [referenceElement, setReferenceElement] =
2628
useState<HTMLDivElement | null>(null);
@@ -49,6 +51,7 @@ export const IconWithTooltip: React.FC<IconWithTooltip> = ({
4951
visible={showTooltip}
5052
referenceElement={referenceElement}
5153
position={tooltipPosition}
54+
content={<p>{tooltipText}</p>}
5255
/>
5356
)}
5457
</>

0 commit comments

Comments
 (0)