-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathChallenge.js
More file actions
55 lines (52 loc) · 1.37 KB
/
Challenge.js
File metadata and controls
55 lines (52 loc) · 1.37 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
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'react-bootstrap';
import ReactMarkdown from 'react-markdown';
const Challenge = ({ challenge }) => (
<div className="col-md-6">
<div className="card challengeCard">
<div className="card-header">
<h3>{challenge.title}</h3>
<ul className="labels_list">
{challenge.labels.map(label => (
<li
className="label"
key={label.id}
style={{ backgroundColor: `#${label.color}` }}
>
{label.name}
</li>
))}
</ul>
<p>
<span>{challenge.comments}</span>
{challenge.comments === 1 ? 'comment' : 'comments'}
</p>
</div>
<div className="card-block">
<ReactMarkdown source={challenge.body} />
</div>
<div className="card-footer">
<Button
bsStyle="primary"
className="btn btn-secondary"
href={challenge.html_url}
target="_blank"
>
More Info
</Button>
</div>
</div>
</div>
);
Challenge.propTypes = {
challenge: PropTypes.shape({
title: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
body: PropTypes.string.isRequired,
}),
};
Challenge.defaultProps = {
challenge: {},
};
export default Challenge;