diff options
| author | Kamran Ahmed <kamranahmed.se@gmail.com> | 2018-08-26 22:23:24 +0500 |
|---|---|---|
| committer | Kamran Ahmed <kamranahmed.se@gmail.com> | 2018-08-26 22:23:24 +0500 |
| commit | 7ecb94a750f0396e88fe8b2a68042571df9ce717 (patch) | |
| tree | f5b2e03122fa659337bfbc265aee8bb57ae202a9 | |
| parent | Repository listing (diff) | |
| download | githunt-7ecb94a750f0396e88fe8b2a68042571df9ce717.tar.gz | |
Add grids repository listing
| -rw-r--r-- | src/components/repository-grid/grid-item/index.js | 42 | ||||
| -rw-r--r-- | src/components/repository-grid/index.js | 2 |
2 files changed, 30 insertions, 14 deletions
diff --git a/src/components/repository-grid/grid-item/index.js b/src/components/repository-grid/grid-item/index.js index b3a850b..f98017e 100644 --- a/src/components/repository-grid/grid-item/index.js +++ b/src/components/repository-grid/grid-item/index.js @@ -1,4 +1,6 @@ import React from 'react'; +import PropTypes from 'prop-types'; +import moment from 'moment'; import './styles.css'; @@ -8,50 +10,60 @@ class GridItem extends React.Component { <div className="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-12 grid-item-container"> <div className="grid-item-body"> <div className="author-header clearfix"> - <a href="#"> + <a href={ this.props.repository.owner.html_url } target="_blank"> <div className="author-img"> - <img src="https://avatars0.githubusercontent.com/u/4921183?s=460&v=4"/> + <img src={ this.props.repository.owner.avatar_url }/> </div> <div className="author-details"> - <h5>kamranahmedse</h5> + <h5>{ this.props.repository.owner.login }</h5> <p className="small text-muted">View Profile</p> </div> </a> </div> <div className="repo-header"> <h5> - <a href="#"><span className="repo-name">design-patterns-for-humans</span></a> + <a href={ this.props.repository.html_url } target="_blank"> + <span className="repo-name">{ this.props.repository.name }</span> + </a> </h5> - <p className="repo-meta text-muted small">Built by · <a href="#">kamranahmedse</a> · July 12, 2018</p> + <p className="repo-meta text-muted small"> + Built by · <a target="_blank" href={ this.props.repository.owner.html_url }>{ this.props.repository.owner.login }</a> · { moment(this.props.repository.created_at).format('MMMM D YYYY') } + </p> </div> <div className="repo-body"> - <p>Create React apps with no build configuration</p> + <p>{ this.props.repository.description || 'No description given.' }</p> </div> <div className="repo-footer"> <span className="d-inline-block mr-3"> <span className="repo-language-color ml-0"></span> <span itemProp="programmingLanguage"> - PHP + { this.props.repository.language } </span> </span> - <a className="muted-link d-inline-block mr-3" href="/ValveSoftware/Proton/stargazers"> + <a className="muted-link d-inline-block mr-3" + href={ `${this.props.repository.html_url}/stargazers` } + target="_blank"> <svg viewBox="0 0 14 16" version="1.1" width="14" height="16" role="img"> <path fillRule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"/> </svg> - 1,532 + { this.props.repository.stargazers_count.toLocaleString() } </a> - <a className="muted-link d-inline-block mr-3" href="/ValveSoftware/Proton/network"> + <a className="muted-link d-inline-block mr-3" + href={ `${this.props.repository.html_url}/network/members` } + target="_blank"> <svg viewBox="0 0 10 16" version="1.1" width="10" height="16" role="img"> <path fillRule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path> </svg> - 30 + { this.props.repository.forks.toLocaleString() } </a> - <a className="muted-link d-inline-block mr-3" href="/ValveSoftware/Proton/network"> + <a className="muted-link d-inline-block mr-3" + href={ `${this.props.repository.html_url}/watchers` } + target="_blank"> <svg className="octicon octicon-eye v-align-text-bottom" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"> <path fillRule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path> </svg> - 55 + { this.props.repository.watchers.toLocaleString() } </a> </div> </div> @@ -60,4 +72,8 @@ class GridItem extends React.Component { } } +GridItem.propTypes = { + repository: PropTypes.object.isRequired +}; + export default GridItem; diff --git a/src/components/repository-grid/index.js b/src/components/repository-grid/index.js index a5c8145..578ff87 100644 --- a/src/components/repository-grid/index.js +++ b/src/components/repository-grid/index.js @@ -25,7 +25,7 @@ class RepositoryGrid extends React.Component { <div key={ groupKey } data-group-key={ groupKey }> { groupHeading } <div className="row grid-container"> - { repositories.map(repository => <GridItem key={ repository.id }/>) } + { repositories.map(repository => <GridItem repository={ repository } key={ repository.id }/>) } </div> </div> ); |
