Browse Source

feat(toolbox): Redesign mobile toolbox

j8
Vlad Piersec 4 years ago
parent
commit
c508572cc5

+ 1
- 1
react/features/base/color-scheme/defaultScheme.js View File

@@ -55,6 +55,6 @@ export default {
55 55
         button: 'rgb(255, 255, 255)',
56 56
         buttonToggled: 'rgb(38, 58, 76)',
57 57
         buttonToggledBorder: getRGBAFormat('#a4b8d1', 0.6),
58
-        hangup: 'rgb(225, 45, 45)'
58
+        hangup: 'rgb(227,79,86)'
59 59
     }
60 60
 };

+ 1
- 0
react/features/base/styles/components/styles/ColorPalette.js View File

@@ -23,6 +23,7 @@ export const ColorPalette = {
23 23
     blueHighlight: '#1081b2',
24 24
     buttonUnderlay: '#495258',
25 25
     darkGrey: '#555555',
26
+    darkBackground: 'rgb(19,21,25)',
26 27
     green: '#40b183',
27 28
     lightGrey: '#AAAAAA',
28 29
     overflowMenuItemUnderlay: '#EEEEEE',

+ 0
- 0
react/features/base/toolbox/components/_.native.js View File


+ 3
- 0
react/features/base/toolbox/components/_.web.js View File

@@ -0,0 +1,3 @@
1
+// @flow
2
+
3
+export * from './web';

+ 1
- 2
react/features/base/toolbox/components/index.js View File

@@ -6,5 +6,4 @@ export type { Props as AbstractButtonProps } from './AbstractButton';
6 6
 export { default as AbstractHangupButton } from './AbstractHangupButton';
7 7
 export { default as AbstractVideoMuteButton } from './AbstractVideoMuteButton';
8 8
 export { default as BetaTag } from './BetaTag';
9
-export { default as OverflowMenuItem } from './OverflowMenuItem';
10
-export { default as ToolboxButtonWithIcon } from './ToolboxButtonWithIcon';
9
+export * from './_';

react/features/base/toolbox/components/OverflowMenuItem.web.js → react/features/base/toolbox/components/web/OverflowMenuItem.js View File

@@ -2,8 +2,8 @@
2 2
 
3 3
 import React, { Component } from 'react';
4 4
 
5
-import { Icon } from '../../icons';
6
-import { Tooltip } from '../../tooltip';
5
+import { Icon } from '../../../icons';
6
+import { Tooltip } from '../../../tooltip';
7 7
 
8 8
 /**
9 9
  * The type of the React {@code Component} props of {@link OverflowMenuItem}.

react/features/base/toolbox/components/ToolboxButtonWithIcon.js → react/features/base/toolbox/components/web/ToolboxButtonWithIcon.js View File

@@ -2,8 +2,8 @@
2 2
 
3 3
 import React from 'react';
4 4
 
5
-import { Icon } from '../../icons';
6
-import { Tooltip } from '../../tooltip';
5
+import { Icon } from '../../../icons';
6
+import { Tooltip } from '../../../tooltip';
7 7
 
8 8
 type Props = {
9 9
 

+ 119
- 0
react/features/base/toolbox/components/web/ToolboxItem.js View File

@@ -0,0 +1,119 @@
1
+// @flow
2
+
3
+import React, { Fragment } from 'react';
4
+
5
+import { Icon } from '../../../icons';
6
+import { Tooltip } from '../../../tooltip';
7
+import AbstractToolboxItem from '../AbstractToolboxItem';
8
+import type { Props } from '../AbstractToolboxItem';
9
+
10
+/**
11
+ * Web implementation of {@code AbstractToolboxItem}.
12
+ */
13
+export default class ToolboxItem extends AbstractToolboxItem<Props> {
14
+    /**
15
+     * Initializes a new {@code ToolboxItem} instance.
16
+     *
17
+     * @inheritdoc
18
+     */
19
+    constructor(props: Props) {
20
+        super(props);
21
+
22
+        this._onKeyDown = this._onKeyDown.bind(this);
23
+    }
24
+
25
+    _onKeyDown: (Object) => void;
26
+
27
+    /**
28
+     * Handles 'Enter' key on the button to trigger onClick for accessibility.
29
+     * We should be handling Space onKeyUp but it conflicts with PTT.
30
+     *
31
+     * @param {Object} event - The key event.
32
+     * @private
33
+     * @returns {void}
34
+     */
35
+    _onKeyDown(event) {
36
+        // If the event coming to the dialog has been subject to preventDefault
37
+        // we don't handle it here.
38
+        if (event.defaultPrevented) {
39
+            return;
40
+        }
41
+
42
+        if (event.key === 'Enter') {
43
+            event.preventDefault();
44
+            event.stopPropagation();
45
+            this.props.onClick();
46
+        }
47
+    }
48
+
49
+    /**
50
+     * Handles rendering of the actual item. If the label is being shown, which
51
+     * is controlled with the `showLabel` prop, the item is rendered for its
52
+     * display in an overflow menu, otherwise it will only have an icon, which
53
+     * can be displayed on any toolbar.
54
+     *
55
+     * @protected
56
+     * @returns {ReactElement}
57
+     */
58
+    _renderItem() {
59
+        const {
60
+            disabled,
61
+            elementAfter,
62
+            onClick,
63
+            showLabel,
64
+            tooltipPosition,
65
+            toggled
66
+        } = this.props;
67
+        const className = showLabel ? 'overflow-menu-item' : 'toolbox-button';
68
+        const props = {
69
+            'aria-pressed': toggled,
70
+            'aria-disabled': disabled,
71
+            'aria-label': this.accessibilityLabel,
72
+            className: className + (disabled ? ' disabled' : ''),
73
+            onClick: disabled ? undefined : onClick,
74
+            onKeyDown: this._onKeyDown,
75
+            tabIndex: 0,
76
+            role: 'button'
77
+        };
78
+
79
+        const elementType = showLabel ? 'li' : 'div';
80
+        const useTooltip = this.tooltip && this.tooltip.length > 0;
81
+        let children = (
82
+            <Fragment>
83
+                { this._renderIcon() }
84
+                { showLabel && <span>
85
+                    { this.label }
86
+                </span> }
87
+                { elementAfter }
88
+            </Fragment>
89
+        );
90
+
91
+        if (useTooltip) {
92
+            children = (
93
+                <Tooltip
94
+                    content = { this.tooltip }
95
+                    position = { tooltipPosition }>
96
+                    { children }
97
+                </Tooltip>
98
+            );
99
+        }
100
+
101
+        return React.createElement(elementType, props, children);
102
+    }
103
+
104
+    /**
105
+     * Helper function to render the item's icon.
106
+     *
107
+     * @private
108
+     * @returns {ReactElement}
109
+     */
110
+    _renderIcon() {
111
+        const { customClass, disabled, icon, showLabel, toggled } = this.props;
112
+        const iconComponent = <Icon src = { icon } />;
113
+        const elementType = showLabel ? 'span' : 'div';
114
+        const className = `${showLabel ? 'overflow-menu-item-icon' : 'toolbox-icon'} ${
115
+            toggled ? 'toggled' : ''} ${disabled ? 'disabled' : ''} ${customClass ?? ''}`;
116
+
117
+        return React.createElement(elementType, { className }, iconComponent);
118
+    }
119
+}

+ 4
- 0
react/features/base/toolbox/components/web/index.js View File

@@ -0,0 +1,4 @@
1
+// @flow
2
+
3
+export { default as OverflowMenuItem } from './OverflowMenuItem';
4
+export { default as ToolboxButtonWithIcon } from './ToolboxButtonWithIcon';

+ 2
- 13
react/features/conference/components/native/Conference.js View File

@@ -310,21 +310,10 @@ class Conference extends AbstractConference<Props, *> {
310 310
 
311 311
                     <LonelyMeetingExperience />
312 312
 
313
-                    {/*
314
-                      * The Toolbox is in a stacking layer below the Filmstrip.
315
-                      */}
313
+                    { _shouldDisplayTileView ? undefined : <Filmstrip /> }
314
+
316 315
                     <Toolbox />
317 316
 
318
-                    {/*
319
-                      * The Filmstrip is in a stacking layer above the
320
-                      * LargeVideo. The LargeVideo and the Filmstrip form what
321
-                      * the Web/React app calls "videospace". Presumably, the
322
-                      * name and grouping stem from the fact that these two
323
-                      * React Components depict the videos of the conference's
324
-                      * participants.
325
-                      */
326
-                        _shouldDisplayTileView ? undefined : <Filmstrip />
327
-                    }
328 317
                 </SafeAreaView>
329 318
 
330 319
                 <SafeAreaView

+ 0
- 1
react/features/conference/components/native/styles.js View File

@@ -164,7 +164,6 @@ export default {
164 164
         flexDirection: 'column',
165 165
         justifyContent: 'flex-end',
166 166
         left: 0,
167
-        paddingBottom: BoxModel.padding,
168 167
         position: 'absolute',
169 168
         right: 0,
170 169
 

+ 1
- 1
react/features/display-name/components/native/styles.js View File

@@ -5,7 +5,7 @@ import { ColorPalette } from '../../../base/styles';
5 5
 export default {
6 6
     displayNameBackdrop: {
7 7
         alignSelf: 'center',
8
-        backgroundColor: 'rgba(28, 32, 37, 0.6)',
8
+        backgroundColor: ColorPalette.darkBackground,
9 9
         borderRadius: 4,
10 10
         paddingHorizontal: 16,
11 11
         paddingVertical: 4

+ 8
- 8
react/features/toolbox/components/native/Toolbox.js View File

@@ -97,27 +97,27 @@ class Toolbox extends PureComponent<Props> {
97 97
      */
98 98
     _renderToolbar() {
99 99
         const { _styles } = this.props;
100
-        const { buttonStyles, buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
100
+        const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
101 101
 
102 102
         return (
103 103
             <View
104 104
                 accessibilityRole = 'toolbar'
105 105
                 pointerEvents = 'box-none'
106 106
                 style = { styles.toolbar }>
107
-                <ChatButton
108
-                    styles = { buttonStylesBorderless }
109
-                    toggledStyles = { this._getChatButtonToggledStyle(toggledButtonStyles) } />
110 107
                 <AudioMuteButton
111
-                    styles = { buttonStyles }
108
+                    styles = { buttonStylesBorderless }
112 109
                     toggledStyles = { toggledButtonStyles } />
113
-                <HangupButton
114
-                    styles = { hangupButtonStyles } />
115 110
                 <VideoMuteButton
116
-                    styles = { buttonStyles }
111
+                    styles = { buttonStylesBorderless }
117 112
                     toggledStyles = { toggledButtonStyles } />
113
+                <ChatButton
114
+                    styles = { buttonStylesBorderless }
115
+                    toggledStyles = { this._getChatButtonToggledStyle(toggledButtonStyles) } />
118 116
                 <OverflowMenuButton
119 117
                     styles = { buttonStylesBorderless }
120 118
                     toggledStyles = { toggledButtonStyles } />
119
+                <HangupButton
120
+                    styles = { hangupButtonStyles } />
121 121
             </View>
122 122
         );
123 123
     }

+ 8
- 17
react/features/toolbox/components/native/styles.js View File

@@ -3,7 +3,7 @@
3 3
 import { ColorSchemeRegistry, schemeColor } from '../../../base/color-scheme';
4 4
 import { BoxModel, ColorPalette } from '../../../base/styles';
5 5
 
6
-const BUTTON_SIZE = 50;
6
+const BUTTON_SIZE = 48;
7 7
 
8 8
 // Toolbox, toolbar:
9 9
 
@@ -11,8 +11,7 @@ const BUTTON_SIZE = 50;
11 11
  * The style of toolbar buttons.
12 12
  */
13 13
 const toolbarButton = {
14
-    backgroundColor: schemeColor('button'),
15
-    borderRadius: BUTTON_SIZE / 2,
14
+    borderRadius: 3,
16 15
     borderWidth: 0,
17 16
     flex: 0,
18 17
     flexDirection: 'row',
@@ -31,16 +30,9 @@ const toolbarButton = {
31 30
 const toolbarButtonIcon = {
32 31
     alignSelf: 'center',
33 32
     color: ColorPalette.darkGrey,
34
-    fontSize: 22
33
+    fontSize: 24
35 34
 };
36 35
 
37
-/**
38
- * The style of toolbar buttons which display white icons.
39
- */
40
-const whiteToolbarButton = {
41
-    ...toolbarButton,
42
-    backgroundColor: schemeColor('buttonToggled')
43
-};
44 36
 
45 37
 /**
46 38
  * The icon style of toolbar buttons which display white icons.
@@ -72,11 +64,12 @@ const styles = {
72 64
      */
73 65
     toolbar: {
74 66
         alignItems: 'center',
67
+        backgroundColor: ColorPalette.darkBackground,
75 68
         flexDirection: 'row',
76 69
         flexGrow: 0,
77
-        justifyContent: 'center',
78
-        marginBottom: BoxModel.margin / 2,
79
-        paddingHorizontal: BoxModel.margin
70
+        justifyContent: 'space-between',
71
+        paddingHorizontal: BoxModel.margin,
72
+        paddingVertical: 8
80 73
     },
81 74
 
82 75
     /**
@@ -135,9 +128,7 @@ ColorSchemeRegistry.register('Toolbox', {
135 128
     toggledButtonStyles: {
136 129
         iconStyle: whiteToolbarButtonIcon,
137 130
         style: {
138
-            ...whiteToolbarButton,
139
-            borderColor: schemeColor('buttonToggledBorder'),
140
-            borderWidth: 1
131
+            ...toolbarButton
141 132
         }
142 133
     }
143 134
 });

Loading…
Cancel
Save