ref(components) Replace some InlineDialogs with Popover (#12453)

Remove comments referencing InlineDialog
This commit is contained in:
Robert Pintilii 2022-10-25 16:11:55 +03:00 committed by GitHub
parent 7f879d2154
commit 687837310a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 31 deletions

View File

@ -8,6 +8,7 @@
border-radius: 3px; border-radius: 3px;
overflow: auto; overflow: auto;
padding: 8px; padding: 8px;
margin-bottom: 8px;
} }
&-entry { &-entry {

View File

@ -48,7 +48,7 @@ type Props = {
/** /**
* Callback to invoke when the popover has opened. * Callback to invoke when the popover has opened.
*/ */
onPopoverOpen: Function; onPopoverOpen?: Function;
/** /**
* Whether to display the Popover as a drawer. * Whether to display the Popover as a drawer.
@ -56,8 +56,7 @@ type Props = {
overflowDrawer?: boolean; overflowDrawer?: boolean;
/** /**
* From which side of the dialog trigger the dialog should display. The * Where should the popover content be placed.
* value will be passed to {@code InlineDialog}.
*/ */
position: string; position: string;
@ -89,7 +88,7 @@ type State = {
}; };
/** /**
* Implements a React {@code Component} for showing an {@code InlineDialog} on * Implements a React {@code Component} for showing an {@code Popover} on
* mouseenter of the trigger and contents, and hiding the dialog on mouseleave. * mouseenter of the trigger and contents, and hiding the dialog on mouseleave.
* *
* @augments Component * @augments Component
@ -273,7 +272,7 @@ class Popover extends Component<Props, State> {
} }
/** /**
* Stops displaying the {@code InlineDialog}. * Stops displaying the {@code Popover}.
* *
* @private * @private
* @returns {void} * @returns {void}
@ -289,7 +288,7 @@ class Popover extends Component<Props, State> {
} }
/** /**
* Displays the {@code InlineDialog} and calls any registered onPopoverOpen * Displays the {@code Popover} and calls any registered onPopoverOpen
* callbacks. * callbacks.
* *
* @param {Object} event - The mouse event or the keypress event to intercept. * @param {Object} event - The mouse event or the keypress event to intercept.
@ -300,7 +299,7 @@ class Popover extends Component<Props, State> {
event?.stopPropagation(); event?.stopPropagation();
if (!this.props.disablePopover) { if (!this.props.disablePopover) {
this.props.onPopoverOpen(); this.props.onPopoverOpen?.();
} }
} }
@ -377,7 +376,7 @@ class Popover extends Component<Props, State> {
} }
/** /**
* Renders the React Element to be displayed in the {@code InlineDialog}. * Renders the React Element to be displayed in the {@code Popover}.
* Also adds padding to support moving the mouse from the trigger to the * Also adds padding to support moving the mouse from the trigger to the
* dialog to prevent mouseleave events. * dialog to prevent mouseleave events.
* *

View File

@ -1,12 +1,12 @@
// @flow // @flow
import InlineDialog from '@atlaskit/inline-dialog';
import React from 'react'; import React from 'react';
import { import {
getVideoDeviceIds, getVideoDeviceIds,
setVideoInputDeviceAndUpdateSettings setVideoInputDeviceAndUpdateSettings
} from '../../../../base/devices'; } from '../../../../base/devices';
import Popover from '../../../../base/popover/components/Popover.web';
import { connect } from '../../../../base/redux'; import { connect } from '../../../../base/redux';
import { SMALL_MOBILE_WIDTH } from '../../../../base/responsive-ui/constants'; import { SMALL_MOBILE_WIDTH } from '../../../../base/responsive-ui/constants';
import { getCurrentCameraDeviceId } from '../../../../base/settings'; import { getCurrentCameraDeviceId } from '../../../../base/settings';
@ -55,17 +55,18 @@ function VideoSettingsPopup({
}: Props) { }: Props) {
return ( return (
<div className = 'video-preview'> <div className = 'video-preview'>
<InlineDialog <Popover
content = { <VideoSettingsContent content = { <VideoSettingsContent
currentCameraDeviceId = { currentCameraDeviceId } currentCameraDeviceId = { currentCameraDeviceId }
setVideoInputDevice = { setVideoInputDevice } setVideoInputDevice = { setVideoInputDevice }
toggleVideoSettings = { onClose } toggleVideoSettings = { onClose }
videoDeviceIds = { videoDeviceIds } /> } videoDeviceIds = { videoDeviceIds } /> }
isOpen = { isOpen } onPopoverClose = { onClose }
onClose = { onClose } position = { popupPlacement }
placement = { popupPlacement }> trigger = 'click'
visible = { isOpen }>
{ children } { children }
</InlineDialog> </Popover>
</div> </div>
); );
} }
@ -83,7 +84,7 @@ function mapStateToProps(state) {
return { return {
currentCameraDeviceId: getCurrentCameraDeviceId(state), currentCameraDeviceId: getCurrentCameraDeviceId(state),
isOpen: getVideoSettingsVisibility(state), isOpen: getVideoSettingsVisibility(state),
popupPlacement: clientWidth <= SMALL_MOBILE_WIDTH ? 'auto' : 'top-start', popupPlacement: clientWidth <= SMALL_MOBILE_WIDTH ? 'auto' : 'top-end',
videoDeviceIds: getVideoDeviceIds(state) videoDeviceIds: getVideoDeviceIds(state)
}; };
} }

View File

@ -1,10 +1,10 @@
import InlineDialog from '@atlaskit/inline-dialog';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next'; import { WithTranslation } from 'react-i18next';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents'; import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions'; import { sendAnalytics } from '../../../analytics/functions';
import { translate } from '../../../base/i18n/functions'; import { translate } from '../../../base/i18n/functions';
import Popover from '../../../base/popover/components/Popover.web';
import HangupToggleButton from './HangupToggleButton'; import HangupToggleButton from './HangupToggleButton';
@ -81,17 +81,18 @@ class HangupMenuButton extends Component<IProps> {
return ( return (
<div className = 'toolbox-button-wth-dialog context-menu'> <div className = 'toolbox-button-wth-dialog context-menu'>
<InlineDialog <Popover
content = { children } content = { children }
isOpen = { isOpen } onPopoverClose = { this._onCloseDialog }
onClose = { this._onCloseDialog } position = 'top'
placement = 'top-end'> trigger = 'click'
visible = { isOpen }>
<HangupToggleButton <HangupToggleButton
customClass = 'hangup-menu-button' customClass = 'hangup-menu-button'
handleClick = { this._toggleDialogVisibility } handleClick = { this._toggleDialogVisibility }
isOpen = { isOpen } isOpen = { isOpen }
onKeyDown = { this._onEscClick } /> onKeyDown = { this._onEscClick } />
</InlineDialog> </Popover>
</div> </div>
); );
} }

View File

@ -31,7 +31,7 @@ interface IProps {
ariaControls: string; ariaControls: string;
/** /**
* A child React Element to display within {@code InlineDialog}. * A child React Element to display within {@code Popover}.
*/ */
children: ReactNode; children: ReactNode;

View File

@ -367,7 +367,8 @@ const styles = () => {
flexDirection: 'column' as const, flexDirection: 'column' as const,
rowGap: '8px', rowGap: '8px',
margin: 0, margin: 0,
padding: '16px' padding: '16px',
marginBottom: '8px'
} }
}; };
}; };

View File

@ -46,8 +46,7 @@ interface IProps extends WithTranslation {
/** /**
* The position relative to the trigger the local video menu should display * The position relative to the trigger the local video menu should display
* from. Valid values are those supported by AtlasKit * from.
* {@code InlineDialog}.
*/ */
_menuPosition: string; _menuPosition: string;

View File

@ -43,8 +43,7 @@ interface IProps extends WithTranslation {
/** /**
* The position relative to the trigger the remote menu should display * The position relative to the trigger the remote menu should display
* from. Valid values are those supported by AtlasKit * from.
* {@code InlineDialog}.
*/ */
_menuPosition: string; _menuPosition: string;