[MM-60156] Migrate tooltips of 'components/file_upload/file_upload.tsx' to WithTooltip (#27970)

Этот коммит содержится в:
Zubair Imtiaz
2024-08-23 07:58:58 +05:00
коммит произвёл GitHub
родитель 8012275ca1
Коммит f2d9b2e94b
2 изменённых файлов: 39 добавлений и 57 удалений

Просмотреть файл

@@ -5,37 +5,26 @@ exports[`components/FileUpload should match snapshot 1`] = `
className="style--none" className="style--none"
> >
<div> <div>
<OverlayTrigger <WithTooltip
defaultOverlayShown={false} id="upload-tooltip"
delayShow={400}
overlay={
<Tooltip
id="upload-tooltip"
>
<Memo(KeyboardShortcutSequence)
hoistDescription={true}
isInsideTooltip={true}
shortcut={
Object {
"default": Object {
"defaultMessage": "Upload files: Ctrl|U",
"id": "shortcuts.files.upload",
},
"mac": Object {
"defaultMessage": "Upload files: ⌘|U",
"id": "shortcuts.files.upload.mac",
},
}
}
/>
</Tooltip>
}
placement="top" placement="top"
trigger={ title={
Array [ <Memo(KeyboardShortcutSequence)
"hover", hoistDescription={true}
"focus", isInsideTooltip={true}
] shortcut={
Object {
"default": Object {
"defaultMessage": "Upload files: Ctrl|U",
"id": "shortcuts.files.upload",
},
"mac": Object {
"defaultMessage": "Upload files: ⌘|U",
"id": "shortcuts.files.upload.mac",
},
}
}
/>
} }
> >
<button <button
@@ -52,7 +41,7 @@ exports[`components/FileUpload should match snapshot 1`] = `
size={18} size={18}
/> />
</button> </button>
</OverlayTrigger> </WithTooltip>
<input <input
accept="" accept=""
aria-label="Upload files" aria-label="Upload files"

Просмотреть файл

@@ -15,10 +15,9 @@ import type {UploadFile} from 'actions/file_actions';
import type {FilePreviewInfo} from 'components/file_preview/file_preview'; import type {FilePreviewInfo} from 'components/file_preview/file_preview';
import KeyboardShortcutSequence, {KEYBOARD_SHORTCUTS} from 'components/keyboard_shortcuts/keyboard_shortcuts_sequence'; import KeyboardShortcutSequence, {KEYBOARD_SHORTCUTS} from 'components/keyboard_shortcuts/keyboard_shortcuts_sequence';
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 from 'utils/constants'; import Constants from 'utils/constants';
import DelayedAction from 'utils/delayed_action'; import DelayedAction from 'utils/delayed_action';
@@ -569,18 +568,15 @@ export class FileUpload extends PureComponent<Props, State> {
if (this.props.pluginFileUploadMethods.length === 0) { if (this.props.pluginFileUploadMethods.length === 0) {
bodyAction = ( bodyAction = (
<div> <div>
<OverlayTrigger <WithTooltip
delayShow={Constants.OVERLAY_TIME_DELAY} id='upload-tooltip'
placement='top' placement='top'
trigger={['hover', 'focus']} title={
overlay={ <KeyboardShortcutSequence
<Tooltip id='upload-tooltip'> shortcut={KEYBOARD_SHORTCUTS.filesUpload}
<KeyboardShortcutSequence hoistDescription={true}
shortcut={KEYBOARD_SHORTCUTS.filesUpload} isInsideTooltip={true}
hoistDescription={true} />
isInsideTooltip={true}
/>
</Tooltip>
} }
> >
<button <button
@@ -599,7 +595,7 @@ export class FileUpload extends PureComponent<Props, State> {
aria-label={iconAriaLabel} aria-label={iconAriaLabel}
/> />
</button> </button>
</OverlayTrigger> </WithTooltip>
<input <input
id='fileUploadInput' id='fileUploadInput'
tabIndex={-1} tabIndex={-1}
@@ -648,18 +644,15 @@ export class FileUpload extends PureComponent<Props, State> {
accept={accept} accept={accept}
/> />
<MenuWrapper> <MenuWrapper>
<OverlayTrigger <WithTooltip
delayShow={Constants.OVERLAY_TIME_DELAY} id='upload-tooltip'
placement='top' placement='top'
trigger={['hover', 'focus']} title={
overlay={ <KeyboardShortcutSequence
<Tooltip id='upload-tooltip'> shortcut={KEYBOARD_SHORTCUTS.filesUpload}
<KeyboardShortcutSequence hoistDescription={true}
shortcut={KEYBOARD_SHORTCUTS.filesUpload} isInsideTooltip={true}
hoistDescription={true} />
isInsideTooltip={true}
/>
</Tooltip>
} }
> >
<button <button
@@ -674,7 +667,7 @@ export class FileUpload extends PureComponent<Props, State> {
aria-label={iconAriaLabel} aria-label={iconAriaLabel}
/> />
</button> </button>
</OverlayTrigger> </WithTooltip>
<Menu <Menu
id='fileUploadOptions' id='fileUploadOptions'
openLeft={true} openLeft={true}