11import React from 'react' ;
22import PropTypes from 'prop-types' ;
3+ import moment from 'moment'
4+ // import 'moment/locale/es' // without this line it didn't work
5+ // moment.locale('es')
6+
37import {
48 withStyles ,
59 Typography ,
610 ButtonBase ,
7- Grid ,
811 Paper ,
12+ Grid ,
913 Chip ,
14+ Link ,
1015
1116} from '@material-ui/core' ;
1217
@@ -32,44 +37,76 @@ const styles = theme => ({
3237 } ,
3338 chip : {
3439 margin : theme . spacing . unit ,
40+ } ,
41+ link : {
42+ margin : theme . spacing . unit ,
3543 }
3644} ) ;
3745
3846
3947
40- const Repo = ( { classes } ) => {
48+ const Repo = ( {
49+ classes,
50+ avatar_url,
51+ name,
52+ html_url,
53+ owner,
54+ description,
55+ stargazers_count,
56+ open_issues_count,
57+ // issues_url,
58+ // stargazers_url,
59+ created_at
60+
61+ } ) => {
62+
63+ // console.log("last 30 days is: ", moment(created_at).fromNow())
4164
4265 return (
4366 < div className = { classes . root } >
4467 < Paper className = { classes . paper } >
4568 < Grid container spacing = { 16 } >
4669 < Grid item >
4770 < ButtonBase className = { classes . image } >
48- < img className = { classes . img } alt = "Owner Avatar" src = "" />
71+ < a href = { ` https://github.com/${ owner } ` } target = "_blank" rel = "noopener noreferrer" >
72+ < img className = { classes . img } alt = "Owner Avatar" src = { ` ${ avatar_url } ` } />
73+ </ a >
4974 </ ButtonBase >
5075 </ Grid >
5176 < Grid item xs = { 12 } sm container >
5277 < Grid item xs container direction = "column" spacing = { 24 } >
5378 < Grid item xs >
54- < Typography gutterBottom = { true } variant = "h3" color = 'textPrimary' >
55- Repository name
79+ < Typography gutterBottom = { true } variant = "h3" >
80+ < Link
81+ href = { html_url }
82+ color = "inherit"
83+ target = "_blank"
84+ rel = "noopener noreferrer"
85+ underline = "hover"
86+ className = { classes . link }
87+ >
88+ { name }
89+ </ Link >
5690 </ Typography >
57- < Typography gutterBottom = { true } variant = "headline" > Repository description</ Typography >
91+ < Typography gutterBottom = { true } variant = "headline" > { description } </ Typography >
5892 < Chip
59- label = "Number of stars"
93+ label = { ` Stars: ${ stargazers_count } ` }
6094 className = { classes . chip }
6195 href = "#chip"
6296 clickable
6397 variant = "outlined"
6498 />
6599 < Chip
66- label = "Number of issues"
100+ label = { ` Issues: ${ open_issues_count } ` }
67101 className = { classes . chip }
68- href = "#chip"
69102 clickable
70103 variant = "outlined"
71104 />
72- < Typography color = "primary" inline = { true } > Submitted 30 day ago By Tenserflow</ Typography >
105+ < Typography
106+ color = "primary"
107+ inline = { true } >
108+ Submitted { moment ( created_at ) . fromNow ( ) } By { owner }
109+ </ Typography >
73110 </ Grid >
74111 </ Grid >
75112 </ Grid >
0 commit comments