Skip to content

Commit

Permalink
Hide the Beacon for centered steps or disableBeacon
Browse files Browse the repository at this point in the history
- remove unnecessary null checks
- fix Overlay typo
  • Loading branch information
gilbarbara committed May 21, 2024
1 parent 7327b2c commit 8fc34df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ export default class JoyrideOverlay extends React.Component<OverlayProps, State>

// Hack for Safari bug with mix-blend-mode with z-index
if (getBrowser() === 'safari') {
const { mixBlendMode, zIndex, ...safarOverlay } = overlayStyles;
const { mixBlendMode, zIndex, ...safariOverlay } = overlayStyles;

spotlight = <div style={{ ...safarOverlay }}>{spotlight}</div>;
spotlight = <div style={{ ...safariOverlay }}>{spotlight}</div>;
delete overlayStyles.backgroundColor;
}

Expand Down
7 changes: 4 additions & 3 deletions src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ const spotlight = {

export default function getStyles(props: Props, step: StepMerged) {
const { floaterProps, styles } = props;
const mergedFloaterProps = deepmerge(step?.floaterProps ?? {}, floaterProps ?? {});
const mergedStyles = deepmerge(styles ?? {}, step?.styles ?? {});
const mergedFloaterProps = deepmerge(step.floaterProps ?? {}, floaterProps ?? {});
const mergedStyles = deepmerge(styles ?? {}, step.styles ?? {});
const options = deepmerge(defaultOptions, mergedStyles.options || {}) satisfies StylesOptions;
const hideBeacon = step.placement === 'center' || step.disableBeacon;
let { width } = options;

if (window.innerWidth > 480) {
Expand All @@ -63,7 +64,7 @@ export default function getStyles(props: Props, step: StepMerged) {
const defaultStyles = {
beacon: {
...buttonBase,
display: 'inline-block',
display: hideBeacon ? 'none' : 'inline-block',
height: options.beaconSize,
position: 'relative',
width: options.beaconSize,
Expand Down

0 comments on commit 8fc34df

Please sign in to comment.