Skip to content

Commit

Permalink
Allow spotlight styles to be updated from outside
Browse files Browse the repository at this point in the history
When <Joyride /> is used as third party lib in host react applications, there are several instances where you might need a more finer control on how things are displayed. This change allows developers to manipulate spotlight style if they want according to their needs.

In our case, we are using <Joyride /> with react-pdf to create highlighted section in the pdf. So we need finer control over the spotlight CSS being displayed in our app.
  • Loading branch information
manishPh authored Oct 12, 2023
1 parent d46cfe5 commit ad7dbed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export default class JoyrideOverlay extends React.Component<OverlayProps, State>
const top = getElementPosition(element, spotlightPadding, disableScrollParentFix);

return {
...(isLegacy() ? styles.spotlightLegacy : styles.spotlight),
height: Math.round((elementRect?.height ?? 0) + spotlightPadding * 2),
left: Math.round((elementRect?.left ?? 0) - spotlightPadding),
opacity: showSpotlight ? 1 : 0,
Expand All @@ -118,6 +117,7 @@ export default class JoyrideOverlay extends React.Component<OverlayProps, State>
top,
transition: 'opacity 0.2s',
width: Math.round((elementRect?.width ?? 0) + spotlightPadding * 2),
...(isLegacy() ? styles.spotlightLegacy : styles.spotlight),
} satisfies React.CSSProperties;
}

Expand Down

0 comments on commit ad7dbed

Please sign in to comment.