[MM-59891] Migrate tooltips of 'components/file_attachment/file_attachment.tsx' to WithTooltip (#27855)

This commit is contained in:
Ivy Gesare 2024-08-07 18:46:52 +03:00 committed by GitHub
parent 5238d40101
commit fc198bb46a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,10 +12,9 @@ import {getFileThumbnailUrl, getFileUrl} from 'mattermost-redux/utils/file_utils
import useTooltip from 'components/common/hooks/useTooltip'; import useTooltip from 'components/common/hooks/useTooltip';
import GetPublicModal from 'components/get_public_link_modal'; import GetPublicModal from 'components/get_public_link_modal';
import OverlayTrigger from 'components/overlay_trigger';
import Tooltip from 'components/tooltip';
import Menu from 'components/widgets/menu/menu'; import Menu from 'components/widgets/menu/menu';
import MenuWrapper from 'components/widgets/menu/menu_wrapper'; import MenuWrapper from 'components/widgets/menu/menu_wrapper';
import WithTooltip from 'components/with_tooltip';
import {Constants, FileTypes, ModalIdentifiers} from 'utils/constants'; import {Constants, FileTypes, ModalIdentifiers} from 'utils/constants';
import {trimFilename} from 'utils/file_utils'; import {trimFilename} from 'utils/file_utils';
@ -226,22 +225,15 @@ export default function FileAttachment(props: Props) {
); );
} }
const tooltip = (
<Tooltip id='file-name__tooltip'>
{formatMessage({id: 'file_search_result_item.more_actions', defaultMessage: 'More Actions'})}
</Tooltip>
);
return ( return (
<MenuWrapper <MenuWrapper
onToggle={handleDropdownOpened} onToggle={handleDropdownOpened}
stopPropagationOnToggle={true} stopPropagationOnToggle={true}
> >
<OverlayTrigger <WithTooltip
className='hidden-xs' id='file-name__tooltip'
delayShow={1000} title={formatMessage({id: 'file_search_result_item.more_actions', defaultMessage: 'More Actions'})}
placement='top' placement='top'
overlay={tooltip}
> >
<button <button
ref={buttonRef} ref={buttonRef}
@ -255,7 +247,7 @@ export default function FileAttachment(props: Props) {
> >
<i className='icon icon-dots-vertical'/> <i className='icon icon-dots-vertical'/>
</button> </button>
</OverlayTrigger> </WithTooltip>
<Menu <Menu
id={`file_dropdown_${props.fileInfo.id}`} id={`file_dropdown_${props.fileInfo.id}`}
ariaLabel={'file menu'} ariaLabel={'file menu'}