mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-58856] Migrate tooltips of "components/copy_button.tsx" to WithTooltip (#27433)
This commit is contained in:
parent
e0688e237b
commit
d939c1bd46
@ -3,14 +3,12 @@
|
||||
|
||||
import classNames from 'classnames';
|
||||
import React, {useRef, useState} from 'react';
|
||||
import {Tooltip} from 'react-bootstrap';
|
||||
import {FormattedMessage, defineMessages, useIntl} from 'react-intl';
|
||||
|
||||
import OverlayTrigger from 'components/overlay_trigger';
|
||||
|
||||
import Constants from 'utils/constants';
|
||||
import {copyToClipboard} from 'utils/utils';
|
||||
|
||||
import WithTooltip from './with_tooltip';
|
||||
|
||||
type Props = {
|
||||
content: string;
|
||||
isForText?: boolean;
|
||||
@ -48,20 +46,17 @@ const CopyButton: React.FC<Props> = (props: Props) => {
|
||||
tooltipMessage = messages.copyCode;
|
||||
}
|
||||
|
||||
const tooltip = (
|
||||
<Tooltip id='copyButton'>
|
||||
<FormattedMessage {...tooltipMessage}/>
|
||||
</Tooltip>
|
||||
const tooltipText = (
|
||||
<FormattedMessage {...tooltipMessage}/>
|
||||
);
|
||||
|
||||
const spanClassName = classNames('post-code__clipboard', props.className);
|
||||
|
||||
return (
|
||||
<OverlayTrigger
|
||||
shouldUpdatePosition={true}
|
||||
delayShow={Constants.OVERLAY_TIME_DELAY}
|
||||
<WithTooltip
|
||||
id='copyButton.text'
|
||||
placement={props.placement ?? 'top'}
|
||||
overlay={tooltip}
|
||||
title={tooltipText}
|
||||
>
|
||||
<span
|
||||
className={spanClassName}
|
||||
@ -80,7 +75,7 @@ const CopyButton: React.FC<Props> = (props: Props) => {
|
||||
/>
|
||||
}
|
||||
</span>
|
||||
</OverlayTrigger>
|
||||
</WithTooltip>
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user