-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathgithubpullreqeusts.js
More file actions
65 lines (62 loc) · 1.89 KB
/
githubpullreqeusts.js
File metadata and controls
65 lines (62 loc) · 1.89 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
import { Col, NavLink, Row } from "react-bootstrap";
import styles from "../../styles/GithubPullRequest.module.css";
import Image from "next/image";
import PullsIcon from "../../public/svg/pull";
const GithubPullReqeust = ({ pull }) => {
return (
<Col className={`${styles.column} py-2 px-3 m-2 rounded`}>
<Row className="d-flex align-items-center">
<Col xs="auto" className={`${styles.numbers}`}>
<a href={pull.user.html_url}>
<Image
className="rounded-circle"
src={pull.user.avatar_url}
width={40}
height={40}
/>
</a>
</Col>
<Col xs="auto" className={`${styles.username}`}>
<a href={pull.user.html_url}>
<span>{pull.user.login}</span>
</a>
</Col>
</Row>
<Row className={`${styles.item_container}`}>
<NavLink href={pull.html_url}>{pull.title}</NavLink>
</Row>
<Row className="d-flex align-items-center">
<Col xs="auto" className={`${styles.numbers}`}>
<span className="me-2">
<PullsIcon />
</span>
{pull.state}
</Col>
<Col xs="auto" className={`${styles.numbers}`}>
#{pull.number}
</Col>
</Row>
</Col>
);
};
const GithubPullRequestsList = (props) => {
let data = [];
if (props.data && props.data.pulls && Array.isArray(props.data.pulls.pulls)) {
data =
props.data.pulls.pulls.length > 6
? props.data.pulls.pulls.slice(0, 6)
: props.data.pulls.pulls;
}
return (
<div
className={`${styles.container} d-flex flex-wrap justify-content-center`}
>
{Array.isArray(data) ? (
data.map((pull) => <GithubPullReqeust key={pull.id} pull={pull} />)
) : (
<p className="text-danger"> ERROR </p>
)}
</div>
);
};
export default GithubPullRequestsList;