From af82ae0255eacbf9e2497a53205eb9ae09407af2 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Mon, 6 May 2024 17:41:13 +0200 Subject: SONAR-22148 Spotlight tour for cayc in branch overview --- .../design-system/src/components/SpotlightTour.tsx | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'server/sonar-web/design-system/src/components') diff --git a/server/sonar-web/design-system/src/components/SpotlightTour.tsx b/server/sonar-web/design-system/src/components/SpotlightTour.tsx index 62bc70df15b..c5be29f5a48 100644 --- a/server/sonar-web/design-system/src/components/SpotlightTour.tsx +++ b/server/sonar-web/design-system/src/components/SpotlightTour.tsx @@ -19,6 +19,7 @@ */ import { keyframes } from '@emotion/react'; import styled from '@emotion/styled'; +import { LinkStandalone } from '@sonarsource/echoes-react'; import React from 'react'; import { useIntl } from 'react-intl'; import ReactJoyride, { @@ -26,6 +27,7 @@ import ReactJoyride, { Step as JoyrideStep, TooltipRenderProps, } from 'react-joyride'; +import { LinkProps } from 'react-router-dom'; import tw from 'twin.macro'; import { GLOBAL_POPUP_Z_INDEX, PopupZLevel, themeColor } from '../helpers'; import { findAnchor } from '../helpers/dom'; @@ -37,6 +39,8 @@ import { PopupWrapper } from './popups'; type Placement = 'left' | 'right' | 'top' | 'bottom' | 'center'; export interface SpotlightTourProps extends Omit { + actionLabel?: string; + actionPath?: LinkProps['to']; backLabel?: string; closeLabel?: string; nextLabel?: string; @@ -60,6 +64,8 @@ const DEFAULT_WIDTH = 315; const defultRect = new DOMRect(0, 0, 0, 0); function TooltipComponent({ + actionLabel, + actionPath, continuous, index, step, @@ -73,6 +79,8 @@ function TooltipComponent({ tooltipProps, width = DEFAULT_WIDTH, }: TooltipRenderProps & { + actionLabel?: string; + actionPath?: LinkProps['to']; step: SpotlightTourStep; stepXofYLabel: SpotlightTourProps['stepXofYLabel']; width?: number; @@ -154,6 +162,13 @@ function TooltipComponent({
{step.content}
+ + {actionLabel && actionPath && ( +
+ {actionLabel} +
+ )} +
{(stepXofYLabel || size > 1) && ( @@ -183,6 +198,8 @@ function TooltipComponent({ export function SpotlightTour(props: SpotlightTourProps) { const { + actionLabel, + actionPath, steps, skipLabel, backLabel, @@ -227,7 +244,15 @@ export function SpotlightTour(props: SpotlightTourProps) { }))} tooltipComponent={( tooltipProps: React.PropsWithChildren, - ) => } + ) => ( + + )} {...otherProps} /> ); -- cgit v1.2.3