Skip to content

Commit 2a27fdc

Browse files
Houssein Djirdehmachour
authored andcommitted
style(*): Minor style updates (#665)
1 parent 4bcee46 commit 2a27fdc

File tree

5 files changed

+44
-54
lines changed

5 files changed

+44
-54
lines changed

src/auth/screens/auth-profile.screen.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react';
2+
import styled from 'styled-components/native';
23
import { connect } from 'react-redux';
34
import { bindActionCreators } from 'redux';
45
import {
@@ -44,10 +45,6 @@ const mapDispatchToProps = dispatch =>
4445
);
4546

4647
const styles = StyleSheet.create({
47-
listTitle: {
48-
color: colors.greyDark,
49-
...fonts.fontPrimary,
50-
},
5148
update: {
5249
flex: 1,
5350
alignItems: 'center',
@@ -72,6 +69,17 @@ const styles = StyleSheet.create({
7269
},
7370
});
7471

72+
const BioListItem = styled(ListItem).attrs({
73+
containerStyle: {
74+
borderBottomColor: colors.greyLight,
75+
borderBottomWidth: 1,
76+
},
77+
titleStyle: {
78+
color: colors.greyDark,
79+
...fonts.fontPrimary,
80+
},
81+
})``;
82+
7583
class AuthProfile extends Component {
7684
props: {
7785
getUser: Function,
@@ -154,10 +162,9 @@ class AuthProfile extends Component {
154162
user.bio &&
155163
user.bio !== '' && (
156164
<SectionList title={translate('common.bio', locale)}>
157-
<ListItem
165+
<BioListItem
158166
titleNumberOfLines={0}
159167
title={emojifyText(user.bio)}
160-
titleStyle={styles.listTitle}
161168
hideChevron
162169
/>
163170
</SectionList>

src/auth/screens/user-options.screen.js

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-shadow */
22
import React, { Component } from 'react';
3+
import styled from 'styled-components/native';
34
import { connect } from 'react-redux';
45
import { bindActionCreators } from 'redux';
56
import {
@@ -46,14 +47,6 @@ const styles = StyleSheet.create({
4647
color: colors.black,
4748
...fonts.fontPrimary,
4849
},
49-
listSubTitle: {
50-
color: colors.greyDark,
51-
...fonts.fontPrimary,
52-
},
53-
logoutTitle: {
54-
color: colors.red,
55-
...fonts.fontPrimary,
56-
},
5750
update: {
5851
flex: 1,
5952
alignItems: 'center',
@@ -73,14 +66,20 @@ const styles = StyleSheet.create({
7366
paddingRight: 7,
7467
color: colors.black, // random any color for the correct display emoji
7568
},
69+
});
70+
71+
const StyledListItem = styled(ListItem).attrs({
7672
containerStyle: {
77-
paddingTop: 0,
78-
paddingBottom: 0,
79-
height: 45,
80-
justifyContent: 'center',
81-
alignItems: 'center',
73+
borderBottomColor: colors.greyLight,
74+
borderBottomWidth: 1,
8275
},
83-
});
76+
titleStyle: props => ({
77+
color: props.signOut ? colors.red : colors.black,
78+
...fonts.fontPrimary,
79+
}),
80+
underlayColor: colors.greyLight,
81+
hideChevron: props => props.hideChevron,
82+
})``;
8483

8584
const updateText = locale => ({
8685
check: translate('auth.profile.codePushCheck', locale),
@@ -167,7 +166,7 @@ class UserOptions extends Component {
167166
data={languages}
168167
renderItem={({ item }) => {
169168
return (
170-
<ListItem
169+
<StyledListItem
171170
title={
172171
<View style={styles.language}>
173172
<Text style={styles.flag}>
@@ -176,12 +175,9 @@ class UserOptions extends Component {
176175
<Text style={styles.listTitle}>{item.name}</Text>
177176
</View>
178177
}
179-
titleStyle={styles.listTitle}
180-
containerStyle={styles.containerStyle}
181178
hideChevron={locale !== item.code}
182179
rightIcon={{ name: 'check' }}
183180
onPress={() => changeLocale(item.code)}
184-
underlayColor={colors.greyLight}
185181
/>
186182
);
187183
}}
@@ -191,36 +187,29 @@ class UserOptions extends Component {
191187
</SectionList>
192188

193189
<SectionList>
194-
<ListItem
190+
<StyledListItem
195191
title={translate('common.openInBrowser', locale)}
196-
titleStyle={styles.listTitle}
197192
onPress={() => openURLInView(this.props.user.html_url)}
198-
underlayColor={colors.greyLight}
199193
/>
200194

201-
<ListItem
195+
<StyledListItem
202196
title={translate('auth.userOptions.privacyPolicy', locale)}
203-
titleStyle={styles.listTitle}
204197
onPress={() =>
205198
navigation.navigate('PrivacyPolicy', {
206199
title: translate('auth.privacyPolicy.title', locale),
207200
locale,
208201
})}
209-
underlayColor={colors.greyLight}
210202
/>
211-
<ListItem
203+
<StyledListItem
212204
title={translate('auth.userOptions.donate', locale)}
213-
titleStyle={styles.listTitle}
214205
onPress={() =>
215206
openURLInView('https://opencollective.com/git-point')}
216-
underlayColor={colors.greyLight}
217207
/>
218-
<ListItem
208+
<StyledListItem
219209
title={translate('auth.userOptions.signOut', locale)}
220-
titleStyle={styles.logoutTitle}
221210
hideChevron
222211
onPress={() => this.signOutUser()}
223-
underlayColor={colors.greyLight}
212+
signOut
224213
/>
225214
</SectionList>
226215

src/components/section-list.component.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ type Props = {
1010
children?: React.Element<*>,
1111
showButton: boolean,
1212
buttonTitle: string,
13-
noOuterBorders: boolean,
1413
noItems: boolean,
1514
noItemsMessage: string,
1615
buttonAction: Function,
@@ -45,10 +44,8 @@ const styles = StyleSheet.create({
4544
},
4645
list: {
4746
marginTop: 0,
48-
},
49-
noOuterBorders: {
50-
borderTopWidth: 0,
51-
borderBottomWidth: 0,
47+
borderBottomColor: colors.grey,
48+
borderBottomWidth: 1,
5249
},
5350
loadingIcon: {
5451
marginVertical: 20,
@@ -61,7 +58,6 @@ export const SectionList = ({
6158
showButton,
6259
buttonTitle,
6360
buttonAction,
64-
noOuterBorders,
6561
noItems,
6662
noItemsMessage,
6763
children,
@@ -109,11 +105,7 @@ export const SectionList = ({
109105
/>
110106
)}
111107
</View>
112-
<List
113-
containerStyle={[styles.list, noOuterBorders && styles.noOuterBorders]}
114-
>
115-
{listDisplay}
116-
</List>
108+
<List containerStyle={styles.list}>{listDisplay}</List>
117109
</View>
118110
);
119111
};

src/notifications/screens/notifications.screen.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ const styles = StyleSheet.create({
127127
markAllAsReadButtonContainer: {
128128
marginTop: 0,
129129
marginBottom: 20,
130-
marginHorizontal: 10,
131130
},
132131
contentBlock: {
133132
flex: 1,

src/user/screens/profile.screen.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable no-shadow */
22
import React, { Component } from 'react';
3+
import styled from 'styled-components/native';
34
import { connect } from 'react-redux';
45
import { bindActionCreators } from 'redux';
56
import {
6-
StyleSheet,
77
ActivityIndicator,
88
Dimensions,
99
View,
@@ -57,12 +57,16 @@ const mapDispatchToProps = dispatch =>
5757
dispatch
5858
);
5959

60-
const styles = StyleSheet.create({
61-
listTitle: {
60+
const BioListItem = styled(ListItem).attrs({
61+
containerStyle: {
62+
borderBottomColor: colors.greyLight,
63+
borderBottomWidth: 1,
64+
},
65+
titleStyle: {
6266
color: colors.greyDark,
6367
...fonts.fontPrimary,
6468
},
65-
});
69+
})``;
6670

6771
class Profile extends Component {
6872
props: {
@@ -206,10 +210,9 @@ class Profile extends Component {
206210
{!!user.bio &&
207211
user.bio !== '' && (
208212
<SectionList title={translate('common.bio', locale)}>
209-
<ListItem
213+
<BioListItem
210214
titleNumberOfLines={0}
211215
title={emojifyText(user.bio)}
212-
titleStyle={styles.listTitle}
213216
hideChevron
214217
/>
215218
</SectionList>

0 commit comments

Comments
 (0)