11import React from 'react' ;
2- import { StyleSheet } from 'react- native' ;
2+ import styled from 'styled-components/ native' ;
33import { ListItem } from 'react-native-elements' ;
44import Communications from 'react-native-communications' ;
55
@@ -14,31 +14,18 @@ type Props = {
1414 navigation : Object ,
1515} ;
1616
17- const styles = StyleSheet . create ( {
18- badge : {
19- padding : 12 ,
20- paddingTop : 3 ,
21- paddingBottom : 3 ,
22- borderRadius : 20 ,
23- } ,
24- mergedIssue : {
25- backgroundColor : colors . purple ,
26- } ,
27- openIssue : {
28- backgroundColor : colors . green ,
29- } ,
30- closedIssue : {
31- backgroundColor : colors . red ,
32- } ,
33- listTitle : {
17+ const StyledListItem = styled ( ListItem ) . attrs ( {
18+ titleStyle : {
3419 color : colors . black ,
3520 ...fonts . fontPrimary ,
3621 } ,
37- listSubTitle : {
22+ subtitleStyle : {
3823 color : colors . greyDark ,
3924 ...fonts . fontPrimary ,
4025 } ,
41- } ) ;
26+ underlayColor : props => ( props . unknown ? null : colors . greyLight ) ,
27+ hideChevron : props => props . unkown ,
28+ } ) `` ;
4229
4330const getBlogLink = url =>
4431 url . substr ( 0 , 4 ) === 'http' ? url : `http://${ url } ` ;
@@ -78,73 +65,59 @@ export const EntityInfo = ({ entity, orgs, locale, navigation }: Props) => {
7865 < SectionList title = { translate ( 'common.info' , locale ) } >
7966 { ! ! entity . company &&
8067 entity . company !== '' && (
81- < ListItem
68+ < StyledListItem
8269 title = { translate ( 'common.company' , locale ) }
83- titleStyle = { styles . listTitle }
8470 leftIcon = { {
8571 name : 'organization' ,
8672 color : colors . grey ,
8773 type : 'octicon' ,
8874 } }
8975 subtitle = { entity . company }
90- subtitleStyle = { styles . listSubTitle }
9176 onPress = { ( ) => navigateToCompany ( entity . company , orgs , navigation ) }
92- underlayColor = {
93- companyInOrgs ( entity . company , orgs ) ? colors . greyLight : null
94- }
95- hideChevron = { ! companyInOrgs ( entity . company , orgs ) }
77+ unknown = { companyInOrgs ( entity . company , orgs ) }
9678 />
9779 ) }
9880
9981 { ! ! entity . location &&
10082 entity . location !== '' && (
101- < ListItem
83+ < StyledListItem
10284 title = { translate ( 'common.location' , locale ) }
103- titleStyle = { styles . listTitle }
10485 leftIcon = { {
10586 name : 'location' ,
10687 color : colors . grey ,
10788 type : 'octicon' ,
10889 } }
10990 subtitle = { entity . location }
110- subtitleStyle = { styles . listSubTitle }
11191 onPress = { ( ) => Communications . web ( getLocationLink ( entity . location ) ) }
112- underlayColor = { colors . greyLight }
11392 />
11493 ) }
11594
11695 { ! ! entity . email &&
11796 entity . email !== '' && (
118- < ListItem
97+ < StyledListItem
11998 title = { translate ( 'common.email' , locale ) }
120- titleStyle = { styles . listTitle }
12199 leftIcon = { {
122100 name : 'mail' ,
123101 color : colors . grey ,
124102 type : 'octicon' ,
125103 } }
126104 subtitle = { entity . email }
127- subtitleStyle = { styles . listSubTitle }
128105 onPress = { ( ) =>
129106 Communications . email ( [ entity . email ] , null , null , null , null ) }
130- underlayColor = { colors . greyLight }
131107 />
132108 ) }
133109
134110 { ! ! entity . blog &&
135111 entity . blog !== '' && (
136- < ListItem
112+ < StyledListItem
137113 title = { translate ( 'common.website' , locale ) }
138- titleStyle = { styles . listTitle }
139114 leftIcon = { {
140115 name : 'link' ,
141116 color : colors . grey ,
142117 type : 'octicon' ,
143118 } }
144119 subtitle = { entity . blog }
145- subtitleStyle = { styles . listSubTitle }
146120 onPress = { ( ) => Communications . web ( getBlogLink ( entity . blog ) ) }
147- underlayColor = { colors . greyLight }
148121 />
149122 ) }
150123 </ SectionList >
0 commit comments