[MM-59342] Migrate tooltips of "components/plugin_marketplace/marketplace_item/marketplace_item.tsx" to WithTooltip (#27588)
Этот коммит содержится в:
@@ -7,12 +7,9 @@ import React from 'react';
|
|||||||
import type {MarketplaceLabel} from '@mattermost/types/marketplace';
|
import type {MarketplaceLabel} from '@mattermost/types/marketplace';
|
||||||
|
|
||||||
import ExternalLink from 'components/external_link';
|
import ExternalLink from 'components/external_link';
|
||||||
import OverlayTrigger from 'components/overlay_trigger';
|
|
||||||
import Tooltip from 'components/tooltip';
|
|
||||||
import PluginIcon from 'components/widgets/icons/plugin_icon';
|
import PluginIcon from 'components/widgets/icons/plugin_icon';
|
||||||
import Tag from 'components/widgets/tag/tag';
|
import Tag from 'components/widgets/tag/tag';
|
||||||
|
import WithTooltip from 'components/with_tooltip';
|
||||||
import {Constants} from 'utils/constants';
|
|
||||||
|
|
||||||
// Label renders a tag showing a name and a description in a tooltip.
|
// Label renders a tag showing a name and a description in a tooltip.
|
||||||
// If a URL is provided, clicking on the tag will open the URL in a new tab.
|
// If a URL is provided, clicking on the tag will open the URL in a new tab.
|
||||||
@@ -28,17 +25,13 @@ export const Label = ({name, description, url}: MarketplaceLabel): JSX.Element =
|
|||||||
let label;
|
let label;
|
||||||
if (description) {
|
if (description) {
|
||||||
label = (
|
label = (
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
delayShow={Constants.OVERLAY_TIME_DELAY}
|
id={'plugin-marketplace_label_' + name.toLowerCase() + '-tooltip'}
|
||||||
|
title={description}
|
||||||
placement='top'
|
placement='top'
|
||||||
overlay={
|
|
||||||
<Tooltip id={'plugin-marketplace_label_' + name.toLowerCase() + '-tooltip'}>
|
|
||||||
{description}
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{tag}
|
{tag}
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
label = tag;
|
label = tag;
|
||||||
@@ -142,23 +135,14 @@ export default class MarketplaceItem extends React.PureComponent <MarketplaceIte
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (this.state.showTooltip) {
|
if (this.state.showTooltip) {
|
||||||
const displayNameToolTip = (
|
|
||||||
<Tooltip
|
|
||||||
id='marketplace-item-description__tooltip'
|
|
||||||
className='more-modal__description-tooltip'
|
|
||||||
>
|
|
||||||
{descriptionText}
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
|
|
||||||
description = (
|
description = (
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
delayShow={Constants.OVERLAY_TIME_DELAY}
|
id='marketplace-item-description__tooltip'
|
||||||
|
title={descriptionText || ''}
|
||||||
placement='top'
|
placement='top'
|
||||||
overlay={displayNameToolTip}
|
|
||||||
>
|
>
|
||||||
{description}
|
{description}
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user