-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepositoryList.js
More file actions
91 lines (85 loc) · 2.28 KB
/
RepositoryList.js
File metadata and controls
91 lines (85 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React, { Component } from "react";
import {
Card,
CardText,
CardBody,
CardTitle,
CardSubtitle,
Button
} from "reactstrap";
import { getRepositories, getCommits } from "../actions/RepostioryAction";
import { connect } from "react-redux";
import { PropTypes } from "prop-types";
import { Link } from "react-router-dom";
import "./Repocontainer.css";
/** repostitory component */
class RepositoryList extends Component {
/**on component mounted */
componentWillMount() {
this.props.getRepositories(this.props.token);
}
liStyle = {
cursor: "pointer"
};
cardStyle = {
width: "320px",
margin: "20px"
};
cardContainer = {
display: "flex",
flexDirection: "row",
"justify-content": "center",
flexWrap: "wrap"
};
detailview = {
background: "red"
};
mainContainer = {
display: "flex",
flexDirection: "row"
};
render() {
return (
<div>
<h2 class="repoHeader"> List of repositories </h2>
<div style={this.mainContainer}>
<div class="repocontainer" style={this.cardContainer}>
{this.props.repos &&
this.props.repos.length &&
this.props.repos.map(t => {
return (
<Card key={t.id} style={this.cardStyle}>
<CardBody>
<CardTitle className="text-primary">{t.name}</CardTitle>
<CardSubtitle>{t.language}</CardSubtitle>
<CardText className="text-muted">
{t.description}
</CardText>
<Button class="viewcommits">
<Link to={`/commits/${t.name}`}>View commits</Link>
</Button>
</CardBody>
</Card>
);
})}
</div>
</div>
</div>
);
}
}
RepositoryList.propTypes = {
getRepositories: PropTypes.func.isRequired,
repositories: PropTypes.array.isRequired,
getCommits: PropTypes.func.isRequired,
token:PropTypes.string
};
const mapStateToProps = state => ({
repos: state.repos.repositories,
commits: state.repos.commits,
token:state.tokenreducer.token
});
export default connect(
mapStateToProps,
{ getRepositories, getCommits }
)(RepositoryList);