[MM-59330] Migrate tooltips of "components/drafts/draft_actions/action.tsx" to WithTooltip (#27650)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ec8c143bce
Коммит
401fca2648
@@ -4,27 +4,10 @@ exports[`components/drafts/draft_actions/action should match snapshot 1`] = `
|
|||||||
<div
|
<div
|
||||||
className="DraftAction"
|
className="DraftAction"
|
||||||
>
|
>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
className="hidden-xs"
|
id="drafts_action_tooltip_"
|
||||||
defaultOverlayShown={false}
|
|
||||||
delayShow={400}
|
|
||||||
overlay={
|
|
||||||
<Tooltip
|
|
||||||
bsClass="tooltip"
|
|
||||||
className="hidden-xs"
|
|
||||||
id="tooltip_"
|
|
||||||
placement="right"
|
|
||||||
>
|
|
||||||
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
placement="top"
|
placement="top"
|
||||||
trigger={
|
title=""
|
||||||
Array [
|
|
||||||
"hover",
|
|
||||||
"focus",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className="DraftAction__button"
|
className="DraftAction__button"
|
||||||
@@ -35,6 +18,6 @@ exports[`components/drafts/draft_actions/action should match snapshot 1`] = `
|
|||||||
className="icon "
|
className="icon "
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -3,37 +3,25 @@
|
|||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Tooltip} from 'react-bootstrap';
|
|
||||||
|
|
||||||
import OverlayTrigger from 'components/overlay_trigger';
|
|
||||||
|
|
||||||
import Constants from 'utils/constants';
|
|
||||||
|
|
||||||
import './action.scss';
|
import './action.scss';
|
||||||
|
import WithTooltip from 'components/with_tooltip';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
icon: string;
|
icon: string;
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
||||||
tooltipText: React.ReactNode;
|
tooltipText: React.ReactElement | string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function Action({name, icon, onClick, id, tooltipText}: Props) {
|
function Action({name, icon, onClick, id, tooltipText}: Props) {
|
||||||
return (
|
return (
|
||||||
<div className='DraftAction'>
|
<div className='DraftAction'>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
className='hidden-xs'
|
id={`drafts_action_tooltip_${id}`}
|
||||||
delayShow={Constants.OVERLAY_TIME_DELAY}
|
|
||||||
placement='top'
|
placement='top'
|
||||||
overlay={
|
title={tooltipText}
|
||||||
<Tooltip
|
|
||||||
id={`tooltip_${id}`}
|
|
||||||
className='hidden-xs'
|
|
||||||
>
|
|
||||||
{tooltipText}
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -45,7 +33,7 @@ function Action({name, icon, onClick, id, tooltipText}: Props) {
|
|||||||
>
|
>
|
||||||
<i className={`icon ${icon}`}/>
|
<i className={`icon ${icon}`}/>
|
||||||
</button>
|
</button>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user