From 8cc7d7ba4abac8095f615e4bf7ba29096aac22fa Mon Sep 17 00:00:00 2001 From: Matt <20505926+MattSilvaa@users.noreply.github.com> Date: Thu, 30 Mar 2023 06:20:17 -0700 Subject: [PATCH] Migrate changes to monorepo (#22634) Co-authored-by: Mattermost Build --- .../components/src/tour_tip/tour_tip.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/webapp/platform/components/src/tour_tip/tour_tip.tsx b/webapp/platform/components/src/tour_tip/tour_tip.tsx index 4e85e53acf..7f2509bb15 100644 --- a/webapp/platform/components/src/tour_tip/tour_tip.tsx +++ b/webapp/platform/components/src/tour_tip/tour_tip.tsx @@ -1,13 +1,14 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef} from 'react'; +import React, {useRef, useState} from 'react'; import {FormattedMessage} from 'react-intl'; import Tippy from '@tippyjs/react'; import {Placement} from 'tippy.js'; import classNames from 'classnames'; import {PunchOutCoordsHeightAndWidth} from '../common/hooks/useMeasurePunchouts'; +import {useClickOutsideRef} from '../common/hooks/useClickOutsideRef'; import 'tippy.js/dist/tippy.css'; import 'tippy.js/themes/light-border.css'; @@ -89,12 +90,15 @@ export const TourTip = ({ }: Props) => { const FIRST_STEP_INDEX = 0; const triggerRef = useRef(null); + const [useBackdrop, setUseBackdrop] = useState(!hideBackdrop); const onJump = (event: React.MouseEvent, jumpToStep: number) => { - if (handleJump) { - handleJump(event, jumpToStep); - } + handleJump?.(event, jumpToStep); }; + useClickOutsideRef(triggerRef, () => { + setUseBackdrop(false); + }); + // This needs to be changed if root-portal node isn't available to maybe body const rootPortal = document.getElementById('root-portal'); @@ -210,7 +214,7 @@ export const TourTip = ({ > - + />} {show && (