Skip to content

Commit 506812c

Browse files
Place kind of pointer element between tooltip and highlighted element
1 parent aa762f5 commit 506812c

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

src/components/VisualTour/VisualTour.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,30 @@ const StepPopover = ({ highlightedElement, step, titleSuffix, actionButtons }: S
148148
if (tooltip) {
149149
createPopper(highlightedElement, tooltip, {
150150
placement: "auto",
151+
modifiers: [
152+
{
153+
name: "offset",
154+
options: {
155+
offset: [0, 8],
156+
},
157+
},
158+
{
159+
name: "arrow",
160+
},
161+
],
151162
});
152163
}
153164
},
154165
[highlightedElement]
155166
);
156167

157168
return (
158-
<div className={`${eccgui}-tooltip__content` + ` ${eccgui}-tooltip--large`} role="tooltip" ref={tooltipRef}>
169+
<div
170+
className={`${eccgui}-tooltip__content` + ` ${eccgui}-tooltip--large` + ` ${eccgui}-visual-tour__tooltip`}
171+
role="tooltip"
172+
ref={tooltipRef}
173+
>
174+
<div id="arrow" data-popper-arrow></div>
159175
<Card>
160176
<CardHeader>
161177
<CardTitle>{`${step.title} ${titleSuffix}`}</CardTitle>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
11
.#{$eccgui}-visual-tour__highlighted-element {
22
background-color: orange;
33
}
4+
5+
// TODO: From https://popper.js.org/docs/v2/tutorial/ until we fine-tune this part
6+
7+
#arrow,
8+
#arrow::before {
9+
position: absolute;
10+
width: 8px;
11+
height: 8px;
12+
background: dimgrey;
13+
border-radius: 50%;
14+
}
15+
16+
#arrow {
17+
visibility: hidden;
18+
}
19+
20+
#arrow::before {
21+
visibility: visible;
22+
content: "";
23+
}
24+
25+
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="top"] > #arrow {
26+
bottom: -8px;
27+
}
28+
29+
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="bottom"] > #arrow {
30+
top: -8px;
31+
}
32+
33+
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="left"] > #arrow {
34+
right: -8px;
35+
}
36+
37+
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="right"] > #arrow {
38+
left: -8px;
39+
}

0 commit comments

Comments
 (0)