|
1 | 1 | import React from "react";
|
2 | 2 | import PropTypes from "prop-types";
|
3 | 3 |
|
4 |
| -const IssueList = ({ issues, onCloseClick }) => ( |
5 |
| - <table className="table"> |
6 |
| - <thead> |
7 |
| - <tr> |
8 |
| - <th>Title</th> |
9 |
| - <th>Labels</th> |
10 |
| - <th>Assignee</th> |
11 |
| - <th>State</th> |
12 |
| - <th /> |
13 |
| - </tr> |
14 |
| - </thead> |
15 |
| - <tbody> |
16 |
| - {issues.map(issue => { |
17 |
| - return ( |
18 |
| - <tr key={issue.id}> |
19 |
| - <td> |
20 |
| - <a |
21 |
| - href={issue.html_url} |
22 |
| - target="_blank" |
23 |
| - rel="noopener noreferrer" |
24 |
| - > |
25 |
| - {issue.title} |
26 |
| - </a> |
27 |
| - </td> |
28 |
| - <td> |
29 |
| - {issue.labels.map(label => ( |
30 |
| - <React.Fragment key={label.id}> |
31 |
| - <span className="badge badge-primary">{label.name}</span> |
32 |
| - <span> </span> |
33 |
| - </React.Fragment> |
34 |
| - ))} |
35 |
| - </td> |
36 |
| - <td>{issue.assignee.login}</td> |
37 |
| - <td>{issue.state}</td> |
38 |
| - <td> |
39 |
| - <button |
40 |
| - className="btn btn-outline-danger" |
41 |
| - onClick={() => onCloseClick(issue)} |
42 |
| - > |
43 |
| - Close |
44 |
| - </button> |
45 |
| - </td> |
46 |
| - </tr> |
47 |
| - ); |
48 |
| - })} |
49 |
| - </tbody> |
50 |
| - </table> |
| 4 | +const IssueList = ({ issues, onCloseClick, onRefreshClick }) => ( |
| 5 | + <> |
| 6 | + <button className="btn btn-primary my-2" onClick={() => onRefreshClick()}> |
| 7 | + Refresh |
| 8 | + </button> |
| 9 | + <table className="table"> |
| 10 | + <thead> |
| 11 | + <tr> |
| 12 | + <th>Title</th> |
| 13 | + <th>Labels</th> |
| 14 | + <th>Assignee</th> |
| 15 | + <th>State</th> |
| 16 | + <th /> |
| 17 | + </tr> |
| 18 | + </thead> |
| 19 | + <tbody> |
| 20 | + {issues.map(issue => { |
| 21 | + return ( |
| 22 | + <tr key={issue.id}> |
| 23 | + <td> |
| 24 | + <a |
| 25 | + href={issue.html_url} |
| 26 | + target="_blank" |
| 27 | + rel="noopener noreferrer" |
| 28 | + > |
| 29 | + {issue.title} |
| 30 | + </a> |
| 31 | + </td> |
| 32 | + <td> |
| 33 | + {issue.labels.map(label => ( |
| 34 | + <React.Fragment key={label.id}> |
| 35 | + <span className="badge badge-primary">{label.name}</span> |
| 36 | + <span> </span> |
| 37 | + </React.Fragment> |
| 38 | + ))} |
| 39 | + </td> |
| 40 | + <td>{issue.assignee.login}</td> |
| 41 | + <td>{issue.state}</td> |
| 42 | + <td> |
| 43 | + <button |
| 44 | + className="btn btn-outline-danger" |
| 45 | + onClick={() => onCloseClick(issue)} |
| 46 | + > |
| 47 | + Close |
| 48 | + </button> |
| 49 | + </td> |
| 50 | + </tr> |
| 51 | + ); |
| 52 | + })} |
| 53 | + </tbody> |
| 54 | + </table> |
| 55 | + </> |
51 | 56 | );
|
52 | 57 |
|
53 | 58 | IssueList.propTypes = {
|
54 | 59 | issues: PropTypes.array.isRequired,
|
55 |
| - onCloseClick: PropTypes.func.isRequired |
| 60 | + onCloseClick: PropTypes.func.isRequired, |
| 61 | + onRefreshClick: PropTypes.func.isRequired |
56 | 62 | };
|
57 | 63 |
|
58 | 64 | export default IssueList;
|
0 commit comments