Commit 8d76d0cd2ee434d8c1eff5f8d5a4eddb5385dd8e
ux: improve the looks of the bottom tab buttons
Andre Staltz committed on 5/31/2020, 12:51:37 PMParent: 008d3f1c6557714916f5a1eb6ea05ab51add37de
Files changed
android/app/src/main/assets/translations/en.json | changed |
src/frontend/screens/central/styles.ts | changed |
src/frontend/screens/central/view.ts | changed |
typings/i18n-js.d.ts | changed |
android/app/src/main/assets/translations/en.json | ||
---|---|---|
@@ -170,8 +170,13 @@ | ||
170 | 170 | "public": "Public board", |
171 | 171 | "private": "Private messages", |
172 | 172 | "connections": "Connections" |
173 | 173 | }, |
174 | + "tab_footers": { | |
175 | + "public": "Public", | |
176 | + "private": "Private", | |
177 | + "connections": "Connections" | |
178 | + }, | |
174 | 179 | "loading": "Loading...", |
175 | 180 | "building_indexes": "Building database indexes...\nThis may take up to several minutes", |
176 | 181 | "tabs": { |
177 | 182 | "public": { |
src/frontend/screens/central/styles.ts | ||
---|---|---|
@@ -1,14 +1,15 @@ | ||
1 | -/* Copyright (C) 2018-2019 The Manyverse Authors. | |
1 | +/* Copyright (C) 2018-2020 The Manyverse Authors. | |
2 | 2 | * |
3 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
4 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | 6 | |
7 | 7 | import {StyleSheet, ViewStyle} from 'react-native'; |
8 | +import {getStatusBarHeight} from 'react-native-status-bar-height'; | |
8 | 9 | import {Palette} from '../../global-styles/palette'; |
9 | 10 | import {Dimensions} from '../../global-styles/dimens'; |
10 | -import {getStatusBarHeight} from 'react-native-status-bar-height'; | |
11 | +import {Typography} from '../../global-styles/typography'; | |
11 | 12 | |
12 | 13 | const page: ViewStyle = { |
13 | 14 | position: 'absolute', |
14 | 15 | top: 0, |
@@ -50,8 +51,21 @@ | ||
50 | 51 | justifyContent: 'center', |
51 | 52 | alignItems: 'center', |
52 | 53 | }, |
53 | 54 | |
55 | + tabButtonText: { | |
56 | + fontFamily: Typography.fontFamilyReadableText, | |
57 | + fontSize: Typography.fontSizeSmall, | |
58 | + color: Palette.textWeak, | |
59 | + }, | |
60 | + | |
61 | + tabButtonTextSelected: { | |
62 | + fontFamily: Typography.fontFamilyReadableText, | |
63 | + fontSize: Typography.fontSizeSmall, | |
64 | + color: Palette.textBrand, | |
65 | + fontWeight: 'bold', | |
66 | + }, | |
67 | + | |
54 | 68 | menuBackdrop: { |
55 | 69 | backgroundColor: Palette.transparencyDarkStrong, |
56 | 70 | opacity: 1, |
57 | 71 | }, |
src/frontend/screens/central/view.ts | ||
---|---|---|
@@ -7,8 +7,9 @@ | ||
7 | 7 | import xs, {Stream} from 'xstream'; |
8 | 8 | import {ReactElement, Fragment, PureComponent, Component} from 'react'; |
9 | 9 | import { |
10 | 10 | View, |
11 | + Text, | |
11 | 12 | Platform, |
12 | 13 | TouchableNativeFeedback, |
13 | 14 | TouchableOpacity, |
14 | 15 | } from 'react-native'; |
@@ -108,8 +109,19 @@ | ||
108 | 109 | ? styles.updatesCoverSome |
109 | 110 | : styles.updatesCoverAll, |
110 | 111 | }), |
111 | 112 | ]), |
113 | + | |
114 | + h( | |
115 | + Text, | |
116 | + { | |
117 | + style: isSelected | |
118 | + ? styles.tabButtonTextSelected | |
119 | + : styles.tabButtonText, | |
120 | + numberOfLines: 1, | |
121 | + }, | |
122 | + t('central.tab_footers.public'), | |
123 | + ), | |
112 | 124 | ]), |
113 | 125 | ], |
114 | 126 | ); |
115 | 127 | } |
@@ -130,19 +142,10 @@ | ||
130 | 142 | if (prevNum >= 1 && nextNum < 1) return true; |
131 | 143 | return false; |
132 | 144 | } |
133 | 145 | |
134 | - private getIconName() { | |
146 | + public render() { | |
135 | 147 | const {isSelected, numOfUpdates} = this.props; |
136 | - if (numOfUpdates >= 1) { | |
137 | - return isSelected ? 'message-text' : 'message-text-outline'; | |
138 | - } else { | |
139 | - return isSelected ? 'message' : 'message-outline'; | |
140 | - } | |
141 | - } | |
142 | - | |
143 | - public render() { | |
144 | - const {isSelected} = this.props; | |
145 | 148 | return h( |
146 | 149 | Touchable, |
147 | 150 | { |
148 | 151 | ...touchableProps, |
@@ -155,12 +158,24 @@ | ||
155 | 158 | [ |
156 | 159 | h(View, {style: styles.tabButton, pointerEvents: 'box-only'}, [ |
157 | 160 | h(View, [ |
158 | 161 | h(Icon, { |
159 | - name: this.getIconName(), | |
162 | + name: | |
163 | + numOfUpdates >= 1 ? 'message-text-outline' : 'message-outline', | |
160 | 164 | ...(isSelected ? iconProps.tabSelected : iconProps.tab), |
161 | 165 | }), |
162 | 166 | ]), |
167 | + | |
168 | + h( | |
169 | + Text, | |
170 | + { | |
171 | + style: isSelected | |
172 | + ? styles.tabButtonTextSelected | |
173 | + : styles.tabButtonText, | |
174 | + numberOfLines: 1, | |
175 | + }, | |
176 | + t('central.tab_footers.private'), | |
177 | + ), | |
163 | 178 | ]), |
164 | 179 | ], |
165 | 180 | ); |
166 | 181 | } |
@@ -205,20 +220,21 @@ | ||
205 | 220 | return false; |
206 | 221 | } |
207 | 222 | |
208 | 223 | private getIconName() { |
209 | - const {isSelected, details} = this.props; | |
224 | + const {details} = this.props; | |
210 | 225 | if (ConnectionsTabIcon.countConnected(details) > 0) { |
211 | - return isSelected ? 'check-network' : 'check-network-outline'; | |
226 | + return 'check-network-outline'; | |
212 | 227 | } |
213 | 228 | const d = details; |
214 | 229 | if (d?.bluetoothEnabled || d?.internetEnabled || d?.lanEnabled) { |
215 | - return isSelected ? 'network' : 'network-outline'; | |
230 | + return 'network-outline'; | |
216 | 231 | } |
217 | - return isSelected ? 'network-off' : 'network-off-outline'; | |
232 | + return 'network-off-outline'; | |
218 | 233 | } |
219 | 234 | |
220 | 235 | public render() { |
236 | + const {isSelected} = this.props; | |
221 | 237 | return h( |
222 | 238 | Touchable, |
223 | 239 | { |
224 | 240 | ...touchableProps, |
@@ -231,10 +247,21 @@ | ||
231 | 247 | [ |
232 | 248 | h(View, {style: styles.tabButton, pointerEvents: 'box-only'}, [ |
233 | 249 | h(Icon, { |
234 | 250 | name: this.getIconName(), |
235 | - ...(this.props.isSelected ? iconProps.tabSelected : iconProps.tab), | |
251 | + ...(isSelected ? iconProps.tabSelected : iconProps.tab), | |
236 | 252 | }), |
253 | + | |
254 | + h( | |
255 | + Text, | |
256 | + { | |
257 | + style: isSelected | |
258 | + ? styles.tabButtonTextSelected | |
259 | + : styles.tabButtonText, | |
260 | + numberOfLines: 1, | |
261 | + }, | |
262 | + t('central.tab_footers.connections'), | |
263 | + ), | |
237 | 264 | ]), |
238 | 265 | ], |
239 | 266 | ); |
240 | 267 | } |
typings/i18n-js.d.ts | ||
---|---|---|
@@ -79,8 +79,11 @@ | ||
79 | 79 | | 'central.app_name' |
80 | 80 | | 'central.tab_headers.public' |
81 | 81 | | 'central.tab_headers.private' |
82 | 82 | | 'central.tab_headers.connections' |
83 | + | 'central.tab_footers.public' | |
84 | + | 'central.tab_footers.private' | |
85 | + | 'central.tab_footers.connections' | |
83 | 86 | | 'central.loading' |
84 | 87 | | 'central.building_indexes' |
85 | 88 | | 'central.tabs.public.accessibility_label' |
86 | 89 | | 'central.tabs.private.accessibility_label' |
Built with git-ssb-web