瀏覽代碼

feat(ui/polls/security/native): style fixes and updates (#12761)

* feat(base/ui/native): button fixes and ui updates
factor2
Calinteodor 2 年之前
父節點
當前提交
c50111a57d
沒有連結到貢獻者的電子郵件帳戶。

+ 1
- 0
react/features/base/ui/components/native/buttonStyles.ts 查看文件

@@ -55,6 +55,7 @@ export default {
55 55
     buttonLabelTertiary: {
56 56
         ...buttonLabel,
57 57
         color: BaseTheme.palette.text01,
58
+        margin: BaseTheme.spacing[3],
58 59
         textAlign: 'center'
59 60
     },
60 61
 

+ 12
- 11
react/features/polls/components/native/PollCreate.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import React, { useCallback, useEffect, useRef, useState } from 'react';
2
-import { FlatList, Platform, Text, View } from 'react-native';
3
-import { Divider, TouchableRipple } from 'react-native-paper';
2
+import { FlatList, Platform, View } from 'react-native';
3
+import { Divider } from 'react-native-paper';
4 4
 
5 5
 import Button from '../../../base/ui/components/native/Button';
6 6
 import Input from '../../../base/ui/components/native/Input';
@@ -52,7 +52,7 @@ const PollCreate = (props: AbstractProps) => {
52 52
      * about whether a newly created input field has been rendered yet or not.
53 53
      */
54 54
     const [ lastFocus, requestFocus ] = useState(null);
55
-    const { PRIMARY, SECONDARY } = BUTTON_TYPES;
55
+    const { PRIMARY, SECONDARY, TERTIARY } = BUTTON_TYPES;
56 56
 
57 57
     useEffect(() => {
58 58
         if (lastFocus === null) {
@@ -85,13 +85,12 @@ const PollCreate = (props: AbstractProps) => {
85 85
 
86 86
     /* eslint-disable react/no-multi-comp */
87 87
     const createRemoveOptionButton = onPress => (
88
-        <TouchableRipple
89
-            onPress = { onPress }
90
-            rippleColor = { 'transparent' } >
91
-            <Text style = { dialogStyles.optionRemoveButtonText }>
92
-                { t('polls.create.removeOption') }
93
-            </Text>
94
-        </TouchableRipple>
88
+        <Button
89
+            labelKey = 'polls.create.removeOption'
90
+            labelStyle = { dialogStyles.optionRemoveButtonText }
91
+            onClick = { onPress }
92
+            style = { dialogStyles.optionRemoveButton }
93
+            type = { TERTIARY } />
95 94
     );
96 95
 
97 96
 
@@ -120,6 +119,8 @@ const PollCreate = (props: AbstractProps) => {
120 119
         );
121 120
     const buttonRowStyles = Platform.OS === 'android'
122 121
         ? chatStyles.buttonRowAndroid : chatStyles.buttonRowIos;
122
+    const pollCreateButtonsContainerStyles = Platform.OS === 'android'
123
+        ? chatStyles.pollCreateButtonsContainerAndroid : chatStyles.pollCreateButtonsContainerIos;
123 124
 
124 125
     return (
125 126
         <View style = { chatStyles.pollCreateContainer }>
@@ -143,7 +144,7 @@ const PollCreate = (props: AbstractProps) => {
143 144
                     keyExtractor = { (item, index) => index.toString() }
144 145
                     ref = { answerListRef }
145 146
                     renderItem = { renderListItem } />
146
-                <View style = { chatStyles.pollCreateButtonsContainer }>
147
+                <View style = { pollCreateButtonsContainerStyles }>
147 148
                     <Button
148 149
                         accessibilityLabel = 'polls.create.addOption'
149 150
                         disabled = { answers.length >= ANSWERS_LIMIT }

+ 21
- 21
react/features/polls/components/native/PollResults.js 查看文件

@@ -1,10 +1,12 @@
1 1
 // @flow
2 2
 
3 3
 import React, { useCallback } from 'react';
4
-import { FlatList, Text, TouchableOpacity, View } from 'react-native';
4
+import { FlatList, Text, View } from 'react-native';
5 5
 import { useSelector } from 'react-redux';
6 6
 
7 7
 import { getLocalParticipant } from '../../../base/participants';
8
+import Button from '../../../base/ui/components/native/Button';
9
+import { BUTTON_TYPES } from '../../../base/ui/constants.native';
8 10
 import AbstractPollResults from '../AbstractPollResults';
9 11
 import type { AbstractProps, AnswerInfo } from '../AbstractPollResults';
10 12
 
@@ -101,26 +103,24 @@ const PollResults = (props: AbstractProps) => {
101 103
                 keyExtractor = { (item, index) => index.toString() }
102 104
                 renderItem = { answer => renderRow(answer.item) } />
103 105
             <View style = { chatStyles.bottomLinks }>
104
-                <TouchableOpacity onPress = { toggleIsDetailed }>
105
-                    <Text
106
-                        style = { chatStyles.toggleText }>
107
-                        {
108
-                            showDetails
109
-                                ? t('polls.results.hideDetailedResults')
110
-                                : t('polls.results.showDetailedResults')
111
-                        }
112
-                    </Text>
113
-                </TouchableOpacity>
114
-                <TouchableOpacity onPress = { changeVote }>
115
-                    <Text
116
-                        style = { chatStyles.toggleText }>
117
-                        {
118
-                            haveVoted
119
-                                ? t('polls.results.changeVote')
120
-                                : t('polls.results.vote')
121
-                        }
122
-                    </Text>
123
-                </TouchableOpacity>
106
+                <Button
107
+                    labelKey = {
108
+                        showDetails
109
+                            ? 'polls.results.hideDetailedResults'
110
+                            : 'polls.results.showDetailedResults'
111
+                    }
112
+                    labelStyle = { chatStyles.toggleText }
113
+                    onClick = { toggleIsDetailed }
114
+                    type = { BUTTON_TYPES.TERTIARY } />
115
+                <Button
116
+                    labelKey = {
117
+                        haveVoted
118
+                            ? 'polls.results.changeVote'
119
+                            : 'polls.results.vote'
120
+                    }
121
+                    labelStyle = { chatStyles.toggleText }
122
+                    onClick = { changeVote }
123
+                    type = { BUTTON_TYPES.TERTIARY } />
124 124
             </View>
125 125
         </View>
126 126
     );

+ 5
- 1
react/features/polls/components/native/PollsPane.js 查看文件

@@ -2,6 +2,7 @@
2 2
 
3 3
 import { useNavigation } from '@react-navigation/native';
4 4
 import React, { useEffect } from 'react';
5
+import { Platform } from 'react-native';
5 6
 import { useSelector } from 'react-redux';
6 7
 
7 8
 import JitsiScreen from '../../../base/modal/components/JitsiScreen';
@@ -39,6 +40,9 @@ const PollsPane = (props: AbstractProps) => {
39 40
 
40 41
     }, [ isPollsTabFocused, nbUnreadPolls ]);
41 42
 
43
+    const createPollButtonStyles = Platform.OS === 'android'
44
+        ? chatStyles.createPollButtonAndroid : chatStyles.createPollButtonIos;
45
+
42 46
     return (
43 47
         <JitsiScreen
44 48
             contentContainerStyle = { chatStyles.pollPane }
@@ -56,7 +60,7 @@ const PollsPane = (props: AbstractProps) => {
56 60
                     accessibilityLabel = 'polls.create.create'
57 61
                     labelKey = 'polls.create.create'
58 62
                     onClick = { onCreate }
59
-                    style = { chatStyles.createPollButton }
63
+                    style = { createPollButtonStyles }
60 64
                     type = { BUTTON_TYPES.PRIMARY } />
61 65
             }
62 66
         </JitsiScreen>

+ 35
- 22
react/features/polls/components/native/styles.js 查看文件

@@ -13,15 +13,14 @@ export const dialogStyles = createStyleSheet({
13 13
     questionText: {
14 14
         ...BaseTheme.typography.bodyShortBold,
15 15
         color: BaseTheme.palette.text01,
16
-        marginBottom: BaseTheme.spacing[2],
17
-        marginLeft: BaseTheme.spacing[2]
16
+        marginLeft: BaseTheme.spacing[1]
18 17
     },
19 18
 
20 19
     questionOwnerText: {
21 20
         ...BaseTheme.typography.bodyShortBold,
22 21
         color: BaseTheme.palette.text03,
23 22
         marginBottom: BaseTheme.spacing[2],
24
-        marginLeft: BaseTheme.spacing[2]
23
+        marginLeft: BaseTheme.spacing[1]
25 24
     },
26 25
 
27 26
     optionContainer: {
@@ -30,6 +29,10 @@ export const dialogStyles = createStyleSheet({
30 29
         marginHorizontal: BaseTheme.spacing[3]
31 30
     },
32 31
 
32
+    optionRemoveButton: {
33
+        width: 128
34
+    },
35
+
33 36
     optionRemoveButtonText: {
34 37
         color: BaseTheme.palette.actionDangerActive
35 38
     },
@@ -82,7 +85,7 @@ export const resultsStyles = createStyleSheet({
82 85
     },
83 86
 
84 87
     answerContainer: {
85
-        marginHorizontal: BaseTheme.spacing[2],
88
+        marginHorizontal: BaseTheme.spacing[1],
86 89
         marginVertical: BaseTheme.spacing[3],
87 90
         maxWidth: '100%'
88 91
     },
@@ -126,7 +129,7 @@ export const chatStyles = createStyleSheet({
126 129
     },
127 130
 
128 131
     pollItemContainer: {
129
-        backgroundColor: BaseTheme.palette.ui02,
132
+        backgroundColor: BaseTheme.palette.uiBackground,
130 133
         borderColor: BaseTheme.palette.border05,
131 134
         borderRadius: BaseTheme.shape.borderRadius,
132 135
         boxShadow: BaseTheme.shape.boxShadow,
@@ -144,14 +147,14 @@ export const chatStyles = createStyleSheet({
144 147
         marginTop: BaseTheme.spacing[3]
145 148
     },
146 149
 
147
-    pollCreateButtonsContainer: {
148
-        marginHorizontal: BaseTheme.spacing[3],
149
-        marginVertical: '8%'
150
+    pollCreateButtonsContainerAndroid: {
151
+        marginBottom: BaseTheme.spacing[8],
152
+        marginHorizontal: BaseTheme.spacing[3]
150 153
     },
151 154
 
152
-    pollCreateButton: {
153
-        flex: 1,
154
-        marginHorizontal: BaseTheme.spacing[1]
155
+    pollCreateButtonsContainerIos: {
156
+        marginBottom: BaseTheme.spacing[5],
157
+        marginHorizontal: BaseTheme.spacing[3]
155 158
     },
156 159
 
157 160
     pollSendLabel: {
@@ -165,20 +168,22 @@ export const chatStyles = createStyleSheet({
165 168
     },
166 169
 
167 170
     buttonRow: {
168
-        flexDirection: 'row'
171
+        flexDirection: 'row',
172
+        justifyContent: 'center'
169 173
     },
170 174
 
171 175
     buttonRowAndroid: {
172 176
         flexDirection: 'row',
173
-        marginBottom: BaseTheme.spacing[3]
177
+        justifyContent: 'space-between'
174 178
     },
175 179
 
176 180
     buttonRowIos: {
177
-        flexDirection: 'row'
181
+        flexDirection: 'row',
182
+        justifyContent: 'space-between'
178 183
     },
179 184
 
180 185
     answerContent: {
181
-        paddingBottom: 8
186
+        marginBottom: BaseTheme.spacing[2]
182 187
     },
183 188
 
184 189
     switchRow: {
@@ -197,19 +202,27 @@ export const chatStyles = createStyleSheet({
197 202
         marginVertical: BaseTheme.spacing[2]
198 203
     },
199 204
 
205
+    pollCreateButton: {
206
+        marginHorizontal: BaseTheme.spacing[1],
207
+        width: 160
208
+    },
209
+
200 210
     toggleText: {
201
-        color: BaseTheme.palette.action01,
202
-        paddingTop: BaseTheme.spacing[3]
211
+        color: BaseTheme.palette.action01
203 212
     },
204 213
 
205
-    createPollButton: {
206
-        marginHorizontal: BaseTheme.spacing[3],
207
-        marginVertical: 34
214
+    createPollButtonIos: {
215
+        marginHorizontal: 20,
216
+        marginVertical: BaseTheme.spacing[5]
217
+    },
218
+
219
+    createPollButtonAndroid: {
220
+        marginHorizontal: 20
208 221
     },
209 222
 
210 223
     pollPane: {
211 224
         flex: 1,
212
-        padding: 8
225
+        padding: BaseTheme.spacing[2]
213 226
     },
214 227
 
215 228
     pollPaneContainer: {
@@ -220,7 +233,7 @@ export const chatStyles = createStyleSheet({
220 233
     bottomLinks: {
221 234
         flexDirection: 'row',
222 235
         justifyContent: 'space-between',
223
-        marginHorizontal: BaseTheme.spacing[2]
236
+        marginHorizontal: BaseTheme.spacing[1]
224 237
     },
225 238
 
226 239
     unreadPollsCounterContainer: {

+ 3
- 7
react/features/security/components/security-dialog/native/styles.js 查看文件

@@ -61,7 +61,6 @@ export default {
61 61
 
62 62
     savedPasswordContainer: {
63 63
         flexDirection: 'row',
64
-        marginTop: 14,
65 64
         width: 208
66 65
     },
67 66
 
@@ -79,8 +78,7 @@ export default {
79 78
     },
80 79
 
81 80
     passwordSetupButtonLabel: {
82
-        color: BaseTheme.palette.link01,
83
-        marginTop: BaseTheme.spacing[3]
81
+        color: BaseTheme.palette.link01
84 82
     },
85 83
 
86 84
     passwordSetRemotelyContainer: {
@@ -90,12 +88,10 @@ export default {
90 88
     },
91 89
 
92 90
     passwordSetRemotelyText: {
93
-        color: BaseTheme.palette.text01,
94
-        marginTop: BaseTheme.spacing[3]
91
+        color: BaseTheme.palette.text01
95 92
     },
96 93
 
97 94
     passwordSetRemotelyTextDisabled: {
98
-        color: BaseTheme.palette.text02,
99
-        marginTop: BaseTheme.spacing[3]
95
+        color: BaseTheme.palette.text02
100 96
     }
101 97
 };

Loading…
取消
儲存