Skip to content

Commit 2cfad22

Browse files
committed
refactor(styles): StyleSheet to Styled Components
Migrate Stylesheet styles to styled components. #532
1 parent a43d3bc commit 2cfad22

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

src/components/issue-list-item.component.js

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
2-
import { StyleSheet, TouchableHighlight, View, Text } from 'react-native';
2+
import { StyleSheet, TouchableHighlight } from 'react-native';
33
import { ListItem, Icon } from 'react-native-elements';
44
import moment from 'moment/min/moment-with-locales.min';
5+
import styled from 'styled-components/native';
56

67
import { colors, fonts, normalize } from 'config';
78
import { translate } from 'utils';
@@ -13,16 +14,28 @@ type Props = {
1314
locale: string,
1415
};
1516

17+
const Container = styled.View`
18+
flex-direction: row;
19+
align-items: flex-start;
20+
justify-content: center;
21+
padding-right: 10;
22+
padding: 5;
23+
border-bottom-width: 1;
24+
border-bottom-color: ${colors.greyLight};
25+
`;
26+
27+
const CommentsContainer = styled.View`
28+
flex-direction: row;
29+
padding-top: 13;
30+
`;
31+
32+
const Comments = styled.Text`
33+
padding-left: 5;
34+
font-size: ${normalize(12)}
35+
color: ${colors.greyBlue}
36+
`;
37+
1638
const styles = StyleSheet.create({
17-
container: {
18-
flexDirection: 'row',
19-
alignItems: 'flex-start',
20-
justifyContent: 'center',
21-
paddingRight: 10,
22-
paddingVertical: 5,
23-
borderBottomWidth: 1,
24-
borderBottomColor: colors.greyLight,
25-
},
2639
closedIssue: {
2740
backgroundColor: colors.greyVeryLight,
2841
opacity: 0.6,
@@ -42,15 +55,6 @@ const styles = StyleSheet.create({
4255
fontWeight: '400',
4356
color: colors.greyBlue,
4457
},
45-
commentsContainer: {
46-
flexDirection: 'row',
47-
paddingTop: 13,
48-
},
49-
comments: {
50-
paddingLeft: 5,
51-
fontSize: normalize(12),
52-
color: colors.greyBlue,
53-
},
5458
});
5559

5660
const getIconName = (type, issue) => {
@@ -72,7 +76,7 @@ export const IssueListItem = ({ type, issue, navigation, locale }: Props) => (
7276
})}
7377
underlayColor={colors.greyLight}
7478
>
75-
<View style={styles.container}>
79+
<Container>
7680
<ListItem
7781
containerStyle={styles.listItemContainer}
7882
title={issue.title}
@@ -99,10 +103,10 @@ export const IssueListItem = ({ type, issue, navigation, locale }: Props) => (
99103
titleStyle={styles.title}
100104
subtitleStyle={styles.subtitle}
101105
/>
102-
<View style={styles.commentsContainer}>
106+
<CommentsContainer>
103107
<Icon name="comment" type="octicon" size={18} color={colors.grey} />
104-
<Text style={styles.comments}>{issue.comments}</Text>
105-
</View>
106-
</View>
108+
<Comments>{issue.comments}</Comments>
109+
</CommentsContainer>
110+
</Container>
107111
</TouchableHighlight>
108112
);

0 commit comments

Comments
 (0)