From c5c0912abec57e3ba61b623641411f29345f8fdb Mon Sep 17 00:00:00 2001 From: ahmadJT <166782331+ahmadJT@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:40:36 +0100 Subject: [PATCH] [MM-58442] Migrate tooltips of 'components/drafts/panel/panel_header' to WithTooltip (#27197) --- .../__snapshots__/panel_header.test.tsx.snap | 27 +++----- .../drafts/panel/panel_header.test.tsx | 6 +- .../components/drafts/panel/panel_header.tsx | 66 ++++++------------- 3 files changed, 32 insertions(+), 67 deletions(-) diff --git a/webapp/channels/src/components/drafts/panel/__snapshots__/panel_header.test.tsx.snap b/webapp/channels/src/components/drafts/panel/__snapshots__/panel_header.test.tsx.snap index 84cd0ae41d..9df4a4795c 100644 --- a/webapp/channels/src/components/drafts/panel/__snapshots__/panel_header.test.tsx.snap +++ b/webapp/channels/src/components/drafts/panel/__snapshots__/panel_header.test.tsx.snap @@ -137,31 +137,20 @@ exports[`components/drafts/panel/panel_header should show sync icon when draft i
- - - - } + } > - +
{ ); expect(wrapper.find('div.PanelHeader__actions').hasClass('PanelHeader__actions show')).toBe(false); - expect(wrapper.find(OverlayTrigger).exists()).toBe(false); + expect(wrapper.find(WithTooltip).exists()).toBe(false); expect(wrapper).toMatchSnapshot(); }); @@ -41,7 +41,7 @@ describe('components/drafts/panel/panel_header', () => { />, ); - expect(wrapper.find(OverlayTrigger).exists()).toBe(true); + expect(wrapper.find(WithTooltip).exists()).toBe(true); expect(wrapper).toMatchSnapshot(); }); diff --git a/webapp/channels/src/components/drafts/panel/panel_header.tsx b/webapp/channels/src/components/drafts/panel/panel_header.tsx index d799d1b7e8..6d4cfc251b 100644 --- a/webapp/channels/src/components/drafts/panel/panel_header.tsx +++ b/webapp/channels/src/components/drafts/panel/panel_header.tsx @@ -8,12 +8,9 @@ import {FormattedMessage} from 'react-intl'; import {SyncIcon} from '@mattermost/compass-icons/components'; -import OverlayTrigger from 'components/overlay_trigger'; import Timestamp from 'components/timestamp'; -import Tooltip from 'components/tooltip'; import Tag from 'components/widgets/tag/tag'; - -import Constants from 'utils/constants'; +import WithTooltip from 'components/with_tooltip'; import './panel_header.scss'; @@ -21,15 +18,7 @@ const TIMESTAMP_PROPS: Partial> = { day: 'numeric', useSemanticOutput: false, useTime: false, - units: [ - 'now', - 'minute', - 'hour', - 'day', - 'week', - 'month', - 'year', - ], + units: ['now', 'minute', 'hour', 'day', 'week', 'month', 'year'], }; type Props = { @@ -38,46 +27,33 @@ type Props = { timestamp: number; remote: boolean; title: React.ReactNode; -} - -function PanelHeader({ - actions, - hover, - timestamp, - remote, - title, -}: Props) { - const syncTooltip = ( - - - - ); +}; +function PanelHeader({actions, hover, timestamp, remote, title}: Props) { return (
-
- {title} -
+
{title}
{actions}
- {remote &&
- - - -
} + {remote && ( +
+ + } + > + + +
+ )}
{Boolean(timestamp) && (