From 5a07d9cb72683fd5b1fbd4f9f80757e49ddd66c7 Mon Sep 17 00:00:00 2001 From: Michael <74271024+KvngMikey@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:57:11 +0100 Subject: [PATCH] [MM-60158] Migrate tooltips of "components/search_results_header/search_results_header.tsx" to WithTooltip (#28005) --- .../search_results_header.tsx | 71 +++++++++---------- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/webapp/channels/src/components/search_results_header/search_results_header.tsx b/webapp/channels/src/components/search_results_header/search_results_header.tsx index 24f2da0a15..0869500f57 100644 --- a/webapp/channels/src/components/search_results_header/search_results_header.tsx +++ b/webapp/channels/src/components/search_results_header/search_results_header.tsx @@ -5,10 +5,9 @@ import React from 'react'; import {FormattedMessage, useIntl} from 'react-intl'; import KeyboardShortcutSequence, {KEYBOARD_SHORTCUTS} from 'components/keyboard_shortcuts/keyboard_shortcuts_sequence'; -import OverlayTrigger from 'components/overlay_trigger'; -import Tooltip from 'components/tooltip'; +import WithTooltip from 'components/with_tooltip'; -import Constants, {RHSStates} from 'utils/constants'; +import {RHSStates} from 'utils/constants'; import type {PropsFromRedux} from './index'; @@ -19,31 +18,12 @@ export interface Props extends PropsFromRedux { function SearchResultsHeader(props: Props) { const {formatMessage} = useIntl(); - const closeSidebarTooltip = ( - - - - ); + const showExpand = props.previousRhsState !== RHSStates.CHANNEL_INFO; - const expandSidebarTooltip = ( - - - - - ); - - const shrinkSidebarTooltip = ( - + // sidebarTooltipContent contains tooltips content for expand or shrink sidebarTooltip. + // if props.isExpanded is true, defaultMessage would feed from 'shrinkTooltip', else 'expandTooltip' + const sidebarTooltipContent = props.isExpanded ? ( + <> - + + ) : ( + <> + + + ); - const showExpand = props.previousRhsState !== RHSStates.CHANNEL_INFO; - return (
@@ -74,10 +64,10 @@ function SearchResultsHeader(props: Props) {
{showExpand && ( - - + )} - + } > - +
);