Skip to content

Commit 4dab32b

Browse files
committed
simplify tour overlay markup/styles
1 parent 2e9641e commit 4dab32b

2 files changed

Lines changed: 46 additions & 56 deletions

File tree

src/components/VisualTour/VisualTour.tsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import { createPortal } from "react-dom";
3+
import { Classes as BlueprintClasses } from "@blueprintjs/core";
34
import { createPopper } from "@popperjs/core";
45

56
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
@@ -229,12 +230,9 @@ const StepPopover = ({ highlightedElement, step, titleOption, actionButtons }: S
229230
{
230231
name: "offset",
231232
options: {
232-
offset: [0, 8],
233+
offset: [0, 15],
233234
},
234235
},
235-
{
236-
name: "arrow",
237-
},
238236
],
239237
});
240238
}
@@ -267,30 +265,34 @@ const StepPopover = ({ highlightedElement, step, titleOption, actionButtons }: S
267265
<div className={`${eccgui}-visual-tour`}>
268266
<div className={`${eccgui}-visual-tour__focushelper`} ref={backdropRef} />
269267
<div>
270-
<div className={`${eccgui}-visual-tour__overlay`} />
268+
<div className={`${eccgui}-visual-tour__backdrop`} />
271269
</div>
272270
<div
273271
className={
274-
`${eccgui}-tooltip__content` +
275-
` ${eccgui}-tooltip--${step.size ?? "large"}` +
276-
` ${eccgui}-visual-tour__tooltip`
272+
`${eccgui}-visual-tour__overlay` +
273+
` ${eccgui}-visual-tour__overlay--${step.size ?? "large"}` +
274+
` ${BlueprintClasses.POPOVER}`
277275
}
278276
role="tooltip"
279277
ref={tooltipRef}
280278
>
281-
<div id="arrow" data-popper-arrow>
282-
<span className={`${eccgui}-visual-tour__tooltip__arrow-shape`} />
279+
<div
280+
className={`${eccgui}-visual-tour__arrow ${BlueprintClasses.POPOVER_ARROW}`}
281+
data-popper-arrow
282+
aria-hidden
283+
/>
284+
<div className={BlueprintClasses.POPOVER_CONTENT}>
285+
<Card isOnlyLayout elevation={-1} whitespaceAmount="small">
286+
<CardHeader>
287+
<CardTitle>{step.title}</CardTitle>
288+
<CardOptions>{titleOption}</CardOptions>
289+
</CardHeader>
290+
<CardContent>
291+
<StepContent step={step} />
292+
</CardContent>
293+
<CardActions inverseDirection>{actionButtons}</CardActions>
294+
</Card>
283295
</div>
284-
<Card>
285-
<CardHeader>
286-
<CardTitle>{step.title}</CardTitle>
287-
<CardOptions>{titleOption}</CardOptions>
288-
</CardHeader>
289-
<CardContent>
290-
<StepContent step={step} />
291-
</CardContent>
292-
<CardActions inverseDirection>{actionButtons}</CardActions>
293-
</Card>
294296
</div>
295297
</div>,
296298
document.body

src/components/VisualTour/visualTour.scss

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,42 @@
1717
box-shadow: 0 0 0 10000px $eccgui-color-modal-backdrop;
1818
}
1919

20-
.#{$eccgui}-visual-tour__overlay {
20+
.#{$eccgui}-visual-tour__backdrop {
2121
position: fixed;
2222
inset: 0;
2323
box-sizing: content-box;
2424
opacity: 0;
2525
}
2626

27-
// TODO: From https://popper.js.org/docs/v2/tutorial/ until we fine-tune this part
28-
29-
#arrow,
30-
#arrow .#{$eccgui}-visual-tour__tooltip__arrow-shape,
31-
#arrow .#{$eccgui}-visual-tour__tooltip__arrow-shape::before {
32-
position: absolute;
33-
border-right: 8px solid transparent;
34-
border-bottom: 8px solid dimgrey;
35-
border-left: 8px solid transparent;
36-
}
37-
38-
#arrow {
39-
visibility: hidden;
40-
}
41-
42-
#arrow .#{$eccgui}-visual-tour__tooltip__arrow-shape::before {
43-
visibility: visible;
44-
content: "";
45-
}
27+
.#{$eccgui}-visual-tour__arrow {
28+
&::before {
29+
background: $card-background-color;
30+
}
4631

47-
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="top"] > #arrow {
48-
bottom: -8px;
49-
.#{$eccgui}-visual-tour__tooltip__arrow-shape::before {
50-
transform: rotate(180deg);
32+
.#{$eccgui}-visual-tour__overlay[data-popper-placement="top"] & {
33+
bottom: -0.5 * $eccgui-size-block-whitespace;
34+
}
35+
.#{$eccgui}-visual-tour__overlay[data-popper-placement="right"] & {
36+
left: -0.5 * $eccgui-size-block-whitespace;
37+
}
38+
.#{$eccgui}-visual-tour__overlay[data-popper-placement="bottom"] & {
39+
top: -0.5 * $eccgui-size-block-whitespace;
40+
}
41+
.#{$eccgui}-visual-tour__overlay[data-popper-placement="left"] & {
42+
right: -0.5 * $eccgui-size-block-whitespace;
5143
}
5244
}
5345

54-
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="bottom"] > #arrow {
55-
top: -8px;
56-
}
46+
.#{$eccgui}-visual-tour__overlay {
47+
&--small {
48+
@extend .#{$eccgui}-tooltip--small;
49+
}
5750

58-
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="left"] > #arrow {
59-
right: 4px;
60-
.#{$eccgui}-visual-tour__tooltip__arrow-shape::before {
61-
transform: rotate(90deg);
51+
&--medium {
52+
@extend .#{$eccgui}-tooltip--medium;
6253
}
63-
}
6454

65-
.#{$eccgui}-visual-tour__tooltip[data-popper-placement^="right"] > #arrow {
66-
left: -28px;
67-
.#{$eccgui}-visual-tour__tooltip__arrow-shape::before {
68-
transform: rotate(270deg);
55+
&--large {
56+
@extend .#{$eccgui}-tooltip--large;
6957
}
7058
}

0 commit comments

Comments
 (0)