Skip to content

Commit fbf91ba

Browse files
committed
cleanup. Add link.
1 parent e1a3568 commit fbf91ba

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/screens/DetailCard.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { View, Text } from 'react-native'
2+
import { View, Text, Linking } from 'react-native'
33
import { Card} from 'react-native-elements'
44
import { IGithubRepoItem } from './Home';
55
import { NavigationStackProp } from 'react-navigation-stack';
@@ -8,32 +8,37 @@ const DetailCard = (props: {navigation: NavigationStackProp<{item: IGithubRepoIt
88
const repo = props.navigation.getParam('item');
99
return (
1010
<Card titleStyle={{fontSize: 24}} title={repo.name} image={{uri: repo.owner.avatar_url}}>
11-
<View>
11+
<>
1212
{ repo.description ? (
13-
<View>
13+
<>
1414
<Text style={{fontSize: 18, fontWeight: 'bold'}}>Description: </Text>
1515
<Text style={{fontSize: 16}}>{repo.description}</Text>
16-
</View>
16+
</>
1717
) : null }
1818
{ repo.stargazers_count ? (
19-
<View>
19+
<>
2020
<Text style={{fontSize: 18, fontWeight: 'bold'}}>Stars: </Text>
2121
<Text style={{fontSize: 16}}>{repo.stargazers_count}</Text>
22-
</View>
22+
</>
2323
) : null }
2424
{ repo.language ? (
25-
<View>
25+
<>
2626
<Text style={{fontSize: 18, fontWeight: 'bold'}}>Language: </Text>
2727
<Text style={{fontSize: 16}}>{repo.language}</Text>
28-
</View>
28+
</>
2929
) : null }
3030
{ repo.owner.login ? (
31-
<View>
31+
<>
3232
<Text style={{fontSize: 18, fontWeight: 'bold'}}>Owner: </Text>
3333
<Text style={{fontSize: 16}}>{repo.owner.login}</Text>
34-
</View>
34+
</>
3535
) : null }
36-
</View>
36+
<Text style={{fontSize: 18, fontWeight: 'bold'}}>Link To Repo: </Text>
37+
<Text style={{color: 'blue', fontSize: 16}}
38+
onPress={() => Linking.openURL(repo.html_url)}>
39+
{repo.html_url}
40+
</Text>
41+
</>
3742
</Card>
3843
)
3944
}

src/screens/Home.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export interface IGithubRepoItem {
1919
name: string,
2020
description: string,
2121
stargazers_count: number,
22-
language: string,
22+
language: string,
23+
html_url: string,
2324
owner: { login: string, avatar_url: string }
2425
}
2526

0 commit comments

Comments
 (0)