File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ const SearchRepos = ({ searchText }) => (
69
69
return (
70
70
< List >
71
71
{ data . search . nodes . map ( repo => (
72
- < Repository { ... repo } />
72
+ < Repository repo = { repo } />
73
73
) ) }
74
74
</ List >
75
75
) ;
Original file line number Diff line number Diff line change @@ -7,27 +7,34 @@ import {
7
7
ListItemText ,
8
8
Typography
9
9
} from "@material-ui/core" ;
10
+ import Stars from "@material-ui/icons/Stars" ;
10
11
import React from "react" ;
11
12
12
- export default function Repository ( { id, owner, name, stargazers } ) {
13
+ export default function Repository ( { repo } ) {
14
+ const starText = repo . viewerHasStarred ? "Unstar" : "Star" ;
15
+
13
16
return (
14
17
< React . Fragment >
15
18
< ListItem alignItems = "flex-start" >
16
19
< ListItemAvatar >
17
- < Avatar alt = { owner . login } src = { owner . avatarUrl } />
20
+ < Avatar alt = { repo . owner . login } src = { repo . owner . avatarUrl } />
18
21
</ ListItemAvatar >
19
22
< ListItemText
20
- primary = { name }
23
+ primary = { repo . name }
21
24
secondary = {
22
25
< React . Fragment >
23
26
< Typography component = "span" color = "textPrimary" >
24
- { owner . login }
27
+ { repo . owner . login }
25
28
</ Typography >
26
29
</ React . Fragment >
27
30
}
28
31
/>
29
32
< ListItemSecondaryAction >
30
- < Chip label = { stargazers . totalCount + " Stars" } />
33
+ < Chip
34
+ label = { `${ starText } ${ repo . stargazers . totalCount } ` }
35
+ clickable
36
+ icon = { < Stars /> }
37
+ />
31
38
</ ListItemSecondaryAction >
32
39
</ ListItem >
33
40
</ React . Fragment >
You can’t perform that action at this time.
0 commit comments