소스 검색

ref(toolbar): rename ToolbarButtonV2 to ToolbarButton

master
Leonard Kim 7 년 전
부모
커밋
6883ee0141

+ 2
- 2
react/features/invite/components/InfoDialogButton.web.js 파일 보기

@@ -6,7 +6,7 @@ import { connect } from 'react-redux';
6 6
 import { createToolbarEvent, sendAnalytics } from '../../analytics';
7 7
 import { translate } from '../../base/i18n';
8 8
 import { getParticipantCount } from '../../base/participants';
9
-import { ToolbarButtonV2 } from '../../toolbox';
9
+import { ToolbarButton } from '../../toolbox';
10 10
 
11 11
 import { updateDialInNumbers } from '../actions';
12 12
 
@@ -162,7 +162,7 @@ class InfoDialogButton extends Component {
162 162
                     isOpen = { showDialog }
163 163
                     onClose = { this._onDialogClose }
164 164
                     position = { 'top right' }>
165
-                    <ToolbarButtonV2
165
+                    <ToolbarButton
166 166
                         accessibilityLabel = 'Info'
167 167
                         iconName = { iconClass }
168 168
                         onClick = { this._onDialogToggle }

+ 2
- 2
react/features/toolbox/components/OverflowMenuButton.web.js 파일 보기

@@ -4,7 +4,7 @@ import React, { Component } from 'react';
4 4
 
5 5
 import { translate } from '../../base/i18n';
6 6
 
7
-import ToolbarButtonV2 from './ToolbarButtonV2';
7
+import ToolbarButton from './ToolbarButton';
8 8
 
9 9
 /**
10 10
  * A React {@code Component} for opening or closing the {@code OverflowMenu}.
@@ -71,7 +71,7 @@ class OverflowMenuButton extends Component {
71 71
                     isOpen = { isOpen }
72 72
                     onClose = { this._onCloseDialog }
73 73
                     position = { 'top right' }>
74
-                    <ToolbarButtonV2
74
+                    <ToolbarButton
75 75
                         accessibilityLabel = 'Overflow'
76 76
                         iconName = { iconClasses }
77 77
                         onClick = { this._onToggleDialogVisibility }

+ 42
- 170
react/features/toolbox/components/ToolbarButton.web.js 파일 보기

@@ -1,207 +1,79 @@
1
-/* @flow */
2
-
3
-import InlineDialog from '@atlaskit/inline-dialog';
4 1
 import Tooltip from '@atlaskit/tooltip';
5 2
 import PropTypes from 'prop-types';
6
-import React, { Component } from 'react';
7
-
8
-import { translate } from '../../base/i18n';
3
+import React from 'react';
9 4
 
10
-import { TOOLTIP_TO_POPUP_POSITION } from '../constants';
11
-import StatelessToolbarButton from './StatelessToolbarButton';
12
-
13
-declare var APP: Object;
5
+import AbstractToolbarButton from './AbstractToolbarButton';
14 6
 
15 7
 /**
16
- * Represents a button in Toolbar on React.
8
+ * Represents a button in the toolbar.
17 9
  *
18
- * @class ToolbarButton
19 10
  * @extends AbstractToolbarButton
20 11
  */
21
-class ToolbarButton extends Component<*> {
22
-    button: Object;
23
-
24
-    _onClick: Function;
12
+class ToolbarButton extends AbstractToolbarButton {
13
+    /**
14
+     * Default values for {@code ToolbarButton} component's properties.
15
+     *
16
+     * @static
17
+     */
18
+    static defaultProps = {
19
+        tooltipPosition: 'top'
20
+    };
25 21
 
26 22
     /**
27
-     * Toolbar button component's property types.
23
+     * {@code ToolbarButton} component's property types.
28 24
      *
29 25
      * @static
30 26
      */
31 27
     static propTypes = {
32
-        ...StatelessToolbarButton.propTypes,
33
-
34
-        /**
35
-         * Object describing button.
36
-         */
37
-        button: PropTypes.object.isRequired,
38
-
39
-        /**
40
-         * Handler for component mount.
41
-         */
42
-        onMount: PropTypes.func,
28
+        ...AbstractToolbarButton.propTypes,
43 29
 
44 30
         /**
45
-         * Handler for component unmount.
31
+         * The text to display in the tooltip.
46 32
          */
47
-        onUnmount: PropTypes.func,
33
+        tooltip: PropTypes.string,
48 34
 
49 35
         /**
50
-         * Translation helper function.
36
+         * From which direction the tooltip should appear, relative to the
37
+         * button.
51 38
          */
52
-        t: PropTypes.func,
53
-
54
-        /**
55
-         * Indicates the position of the tooltip.
56
-         */
57
-        tooltipPosition: PropTypes.oneOf([ 'bottom', 'left', 'right', 'top' ])
58
-    };
59
-
60
-    /**
61
-     * Initializes new ToolbarButton instance.
62
-     *
63
-     * @param {Object} props - The read-only properties with which the new
64
-     * instance is to be initialized.
65
-     */
66
-    constructor(props: Object) {
67
-        super(props);
68
-
69
-        // Bind methods to save the context
70
-        this._onClick = this._onClick.bind(this);
71
-    }
72
-
73
-    /**
74
-     * Sets shortcut/tooltip
75
-     * after mounting of the component.
76
-     *
77
-     * @inheritdoc
78
-     * @returns {void}
79
-     */
80
-    componentDidMount(): void {
81
-        this._setShortcut();
82
-
83
-        if (this.props.onMount) {
84
-            this.props.onMount();
85
-        }
39
+        tooltipPosition: PropTypes.string
86 40
     }
87 41
 
88 42
     /**
89
-     * Invokes on unmount handler if it was passed to the props.
43
+     * Renders the button of this {@code ToolbarButton}.
90 44
      *
91
-     * @inheritdoc
92
-     * @returns {void}
45
+     * @param {Object} children - The children, if any, to be rendered inside
46
+     * the button. Presumably, contains the icon of this {@code ToolbarButton}.
47
+     * @protected
48
+     * @returns {ReactElement} The button of this {@code ToolbarButton}.
93 49
      */
94
-    componentWillUnmount(): void {
95
-        if (this.props.onUnmount) {
96
-            this.props.onUnmount();
97
-        }
50
+    _renderButton(children) {
51
+        return (
52
+            <div
53
+                aria-label = { this.props.accessibilityLabel }
54
+                className = 'toolbox-button'
55
+                onClick = { this.props.onClick }>
56
+                <Tooltip
57
+                    description = { this.props.tooltip }
58
+                    position = { this.props.tooltipPosition }>
59
+                    { children }
60
+                </Tooltip>
61
+            </div>
62
+        );
98 63
     }
99 64
 
100 65
     /**
101
-     * Implements React's {@link Component#render()}.
66
+     * Renders the icon of this {@code ToolbarButton}.
102 67
      *
103 68
      * @inheritdoc
104
-     * @returns {ReactElement}
105 69
      */
106
-    render(): React$Element<*> {
107
-        const { button, t, tooltipPosition } = this.props;
108
-        const props = {
109
-            ...this.props,
110
-            onClick: this._onClick
111
-        };
112
-
113
-        const buttonComponent = ( // eslint-disable-line no-extra-parens
114
-            <Tooltip
115
-                description = { button.tooltipText || t(button.tooltipKey) }
116
-                position = { tooltipPosition }>
117
-                <StatelessToolbarButton { ...props }>
118
-                    { this.props.children }
119
-                </StatelessToolbarButton>
120
-            </Tooltip>
121
-        );
122
-        let children = buttonComponent;
123
-
124
-        const popupConfig = this._getPopupDisplayConfiguration();
125
-
126
-        if (popupConfig) {
127
-            const { dataAttr, dataInterpolate, position } = popupConfig;
128
-
129
-            children = ( // eslint-disable-line no-extra-parens
130
-                <InlineDialog
131
-                    content = {
132
-                        <div className = 'button-popover-message'>
133
-                            { t(dataAttr, dataInterpolate) }
134
-                        </div>
135
-                    }
136
-                    isOpen = { Boolean(popupConfig) }
137
-                    position = { position }>
138
-                    { buttonComponent }
139
-                </InlineDialog>
140
-            );
141
-        }
142
-
70
+    _renderIcon() {
143 71
         return (
144
-            <div className = { `toolbar-button-wrapper ${button.id}-wrapper` }>
145
-                { children }
72
+            <div className = 'toolbox-icon'>
73
+                <i className = { this.props.iconName } />
146 74
             </div>
147 75
         );
148 76
     }
149
-
150
-    /**
151
-     * Wrapper on on click handler props for current button.
152
-     *
153
-     * @param {Event} event - Click event object.
154
-     * @returns {void}
155
-     * @private
156
-     */
157
-    _onClick(event) {
158
-        this.props.onClick(event);
159
-    }
160
-
161
-    /**
162
-     * Parses the props and state to find any popup that should be displayed
163
-     * and returns an object describing how the popup should display.
164
-     *
165
-     * @private
166
-     * @returns {Object|null}
167
-     */
168
-    _getPopupDisplayConfiguration() {
169
-        const { button, tooltipPosition } = this.props;
170
-        const { popups, popupDisplay } = button;
171
-
172
-        if (!popups || !popupDisplay) {
173
-            return null;
174
-        }
175
-
176
-        const { popupID } = popupDisplay;
177
-        const currentPopup = popups.find(popup => popup.id === popupID);
178
-
179
-        return Object.assign(
180
-            {},
181
-            currentPopup || {},
182
-            {
183
-                position: TOOLTIP_TO_POPUP_POSITION[tooltipPosition]
184
-            });
185
-    }
186
-
187
-    /**
188
-     * Sets shortcut and tooltip for current toolbar button.
189
-     *
190
-     * @private
191
-     * @returns {void}
192
-     */
193
-    _setShortcut(): void {
194
-        const { button } = this.props;
195
-
196
-        if (button.shortcut && APP && APP.keyboardshortcut) {
197
-            APP.keyboardshortcut.registerShortcut(
198
-                button.shortcut,
199
-                button.shortcutAttr,
200
-                button.shortcutFunc,
201
-                button.shortcutDescription
202
-            );
203
-        }
204
-    }
205 77
 }
206 78
 
207
-export default translate(ToolbarButton);
79
+export default ToolbarButton;

+ 0
- 0
react/features/toolbox/components/ToolbarButtonV2.native.js 파일 보기


+ 0
- 79
react/features/toolbox/components/ToolbarButtonV2.web.js 파일 보기

@@ -1,79 +0,0 @@
1
-import Tooltip from '@atlaskit/tooltip';
2
-import PropTypes from 'prop-types';
3
-import React from 'react';
4
-
5
-import AbstractToolbarButton from './AbstractToolbarButton';
6
-
7
-/**
8
- * Represents a button in the toolbar.
9
- *
10
- * @extends AbstractToolbarButton
11
- */
12
-class ToolbarButtonV2 extends AbstractToolbarButton {
13
-    /**
14
-     * Default values for {@code ToolbarButtonV2} component's properties.
15
-     *
16
-     * @static
17
-     */
18
-    static defaultProps = {
19
-        tooltipPosition: 'top'
20
-    };
21
-
22
-    /**
23
-     * {@code ToolbarButtonV2} component's property types.
24
-     *
25
-     * @static
26
-     */
27
-    static propTypes = {
28
-        ...AbstractToolbarButton.propTypes,
29
-
30
-        /**
31
-         * The text to display in the tooltip.
32
-         */
33
-        tooltip: PropTypes.string,
34
-
35
-        /**
36
-         * From which direction the tooltip should appear, relative to the
37
-         * button.
38
-         */
39
-        tooltipPosition: PropTypes.string
40
-    }
41
-
42
-    /**
43
-     * Renders the button of this {@code ToolbarButton}.
44
-     *
45
-     * @param {Object} children - The children, if any, to be rendered inside
46
-     * the button. Presumably, contains the icon of this {@code ToolbarButton}.
47
-     * @protected
48
-     * @returns {ReactElement} The button of this {@code ToolbarButton}.
49
-     */
50
-    _renderButton(children) {
51
-        return (
52
-            <div
53
-                aria-label = { this.props.accessibilityLabel }
54
-                className = 'toolbox-button'
55
-                onClick = { this.props.onClick }>
56
-                <Tooltip
57
-                    description = { this.props.tooltip }
58
-                    position = { this.props.tooltipPosition }>
59
-                    { children }
60
-                </Tooltip>
61
-            </div>
62
-        );
63
-    }
64
-
65
-    /**
66
-     * Renders the icon of this {@code ToolbarButton}.
67
-     *
68
-     * @inheritdoc
69
-     */
70
-    _renderIcon() {
71
-        return (
72
-            <div className = 'toolbox-icon'>
73
-                <i className = { this.props.iconName } />
74
-            </div>
75
-        );
76
-    }
77
-}
78
-
79
-export default ToolbarButtonV2;

+ 5
- 5
react/features/toolbox/components/Toolbox.web.js 파일 보기

@@ -34,7 +34,7 @@ import { setFullScreen, setToolbarHovered } from '../actions';
34 34
 import OverflowMenuButton from './OverflowMenuButton';
35 35
 import OverflowMenuItem from './OverflowMenuItem';
36 36
 import OverflowMenuProfileItem from './OverflowMenuProfileItem';
37
-import ToolbarButtonV2 from './ToolbarButtonV2';
37
+import ToolbarButton from './ToolbarButton';
38 38
 import { AudioMuteButton, HangupButton, VideoMuteButton } from './buttons';
39 39
 
40 40
 type Props = {
@@ -332,7 +332,7 @@ class Toolbox extends Component<Props, State> {
332 332
                     { this._shouldShowButton('desktop')
333 333
                         && this._renderDesktopSharingButton() }
334 334
                     { this._shouldShowButton('raisehand')
335
-                        && <ToolbarButtonV2
335
+                        && <ToolbarButton
336 336
                             accessibilityLabel = 'Raised hand'
337 337
                             iconName = { _raisedHand
338 338
                                 ? 'icon-raised-hand toggled'
@@ -341,7 +341,7 @@ class Toolbox extends Component<Props, State> {
341 341
                             tooltip = { t('toolbar.raiseHand') } /> }
342 342
                     { this._shouldShowButton('chat')
343 343
                         && <div className = 'toolbar-button-with-badge'>
344
-                            <ToolbarButtonV2
344
+                            <ToolbarButton
345 345
                                 accessibilityLabel = 'Chat'
346 346
                                 iconName = { _chatOpen
347 347
                                     ? 'icon-chat toggled'
@@ -362,7 +362,7 @@ class Toolbox extends Component<Props, State> {
362 362
                 <div className = 'button-group-right'>
363 363
                     { this._shouldShowButton('invite')
364 364
                         && !_hideInviteButton
365
-                        && <ToolbarButtonV2
365
+                        && <ToolbarButton
366 366
                             accessibilityLabel = 'Invite'
367 367
                             iconName = 'icon-add'
368 368
                             onClick = { this._onToolbarOpenInvite }
@@ -944,7 +944,7 @@ class Toolbox extends Component<Props, State> {
944 944
             : t('toolbar.sharescreen');
945 945
 
946 946
         return (
947
-            <ToolbarButtonV2
947
+            <ToolbarButton
948 948
                 accessibilityLabel = 'Screenshare'
949 949
                 iconName = { classNames }
950 950
                 onClick = { this._onToolbarToggleScreenshare }

+ 2
- 2
react/features/toolbox/components/ToolboxFilmstrip.web.js 파일 보기

@@ -7,7 +7,7 @@ import { createToolbarEvent, sendAnalytics } from '../../analytics';
7 7
 import { translate } from '../../base/i18n';
8 8
 import { openDeviceSelectionDialog } from '../../device-selection';
9 9
 
10
-import ToolbarButtonV2 from './ToolbarButtonV2';
10
+import ToolbarButton from './ToolbarButton';
11 11
 import { AudioMuteButton, HangupButton, VideoMuteButton } from './buttons';
12 12
 
13 13
 declare var interfaceConfig: Object;
@@ -53,7 +53,7 @@ class ToolboxFilmstrip extends Component<*> {
53 53
                 { this._shouldShowButton('camera')
54 54
                     && <VideoMuteButton tooltipPosition = 'left' /> }
55 55
                 { this._shouldShowButton('fodeviceselection')
56
-                    && <ToolbarButtonV2
56
+                    && <ToolbarButton
57 57
                         accessibilityLabel = 'Settings'
58 58
                         iconName = 'icon-settings'
59 59
                         onClick = { this._onToolbarOpenSettings }

+ 2
- 2
react/features/toolbox/components/buttons/AudioMuteButton.web.js 파일 보기

@@ -16,7 +16,7 @@ import { MEDIA_TYPE } from '../../../base/media';
16 16
 import { isLocalTrackMuted } from '../../../base/tracks';
17 17
 
18 18
 import AbstractAudioMuteButton from './AbstractAudioMuteButton';
19
-import ToolbarButtonV2 from '../ToolbarButtonV2';
19
+import ToolbarButton from '../ToolbarButton';
20 20
 
21 21
 declare var APP: Object;
22 22
 
@@ -111,7 +111,7 @@ export class AudioMuteButton extends AbstractAudioMuteButton {
111 111
         const { _audioMuted, _conference, t, tooltipPosition } = this.props;
112 112
 
113 113
         return (
114
-            <ToolbarButtonV2
114
+            <ToolbarButton
115 115
                 accessibilityLabel = 'Audio mute'
116 116
                 iconName = { _audioMuted && _conference
117 117
                     ? 'icon-mic-disabled toggled'

+ 2
- 2
react/features/toolbox/components/buttons/HangupButton.web.js 파일 보기

@@ -9,7 +9,7 @@ import { disconnect } from '../../../base/connection';
9 9
 import { translate } from '../../../base/i18n';
10 10
 
11 11
 import AbstractHangupButton from './AbstractHangupButton';
12
-import ToolbarButtonV2 from '../ToolbarButtonV2';
12
+import ToolbarButton from '../ToolbarButton';
13 13
 
14 14
 /**
15 15
  * Component that renders a toolbar button for leaving the current conference.
@@ -58,7 +58,7 @@ export class HangupButton extends AbstractHangupButton {
58 58
         const { t, tooltipPosition } = this.props;
59 59
 
60 60
         return (
61
-            <ToolbarButtonV2
61
+            <ToolbarButton
62 62
                 accessibilityLabel = 'Hangup'
63 63
                 iconName = 'icon-hangup'
64 64
                 onClick = { this._onToolbarHangup }

+ 2
- 2
react/features/toolbox/components/buttons/VideoMuteButton.web.js 파일 보기

@@ -16,7 +16,7 @@ import { MEDIA_TYPE } from '../../../base/media';
16 16
 import { isLocalTrackMuted } from '../../../base/tracks';
17 17
 
18 18
 import AbstractVideoMuteButton from './AbstractVideoMuteButton';
19
-import ToolbarButtonV2 from '../ToolbarButtonV2';
19
+import ToolbarButton from '../ToolbarButton';
20 20
 
21 21
 declare var APP: Object;
22 22
 
@@ -106,7 +106,7 @@ export class VideoMuteButton extends AbstractVideoMuteButton {
106 106
         const { _conference, _videoMuted, t, tooltipPosition } = this.props;
107 107
 
108 108
         return (
109
-            <ToolbarButtonV2
109
+            <ToolbarButton
110 110
                 accessibilityLabel = 'Video mute'
111 111
                 iconName = { _videoMuted && _conference
112 112
                     ? 'icon-camera-disabled toggled'

+ 0
- 1
react/features/toolbox/components/index.js 파일 보기

@@ -1,4 +1,3 @@
1 1
 export { default as ToolbarButton } from './ToolbarButton';
2
-export { default as ToolbarButtonV2 } from './ToolbarButtonV2';
3 2
 export { default as ToolboxFilmstrip } from './ToolboxFilmstrip';
4 3
 export { default as Toolbox } from './Toolbox';

Loading…
취소
저장