Skip to content

Commit ee7157f

Browse files
committed
Lists - thumbnailList
1 parent 5693d3c commit ee7157f

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

thumbnail-list/index.html

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<head>
2+
<script src="http://fb.me/react-0.13.0.js"></script>
3+
<script src="http://fb.me/JSXTransformer-0.13.0.js"></script>
4+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
5+
</head>
6+
<body>
7+
<div class="container">
8+
</div>
9+
</body>
10+
11+
<script type="text/jsx">
12+
var Badge = React.createClass({
13+
render: function() {
14+
return <button className="btn btn-primary" type="button">
15+
{this.props.title} <span className="badge">{this.props.number}</span>
16+
</button>
17+
}
18+
});
19+
20+
var Thumbnail = React.createClass({
21+
render: function() {
22+
return <div className="col-sm-6 col-md-4">
23+
<div className="thumbnail">
24+
<img src={this.props.imageUrl} alt="..."></img>
25+
<div className="caption">
26+
<h3>{this.props.header}</h3>
27+
<p>{this.props.description}</p>
28+
<p>
29+
<Badge title={this.props.title} number={this.props.number} />
30+
</p>
31+
</div>
32+
</div>
33+
</div>
34+
}
35+
});
36+
37+
var ThumbnailList = React.createClass({
38+
render: function() {
39+
var list = this.props.thumbnailData.map(function(thumbnailProps){
40+
return <Thumbnail {...thumbnailProps} />
41+
});
42+
43+
return <div>
44+
{list}
45+
</div>
46+
}
47+
});
48+
49+
var options = {
50+
thumbnailData: [{
51+
title: 'Show Courses',
52+
number: 12,
53+
header: 'Learn React',
54+
description: 'React is a fantastic new front end library for rendering web pages. React is a fantastic new front end library for rendering web pages.',
55+
imageUrl: 'https://raw.githubusercontent.com/wiki/facebook/react/react-logo-1000-transparent.png'
56+
},{
57+
title: 'Show Courses',
58+
number: 25,
59+
header: 'Learn Gulp',
60+
description: 'Gulp will speed up your development workflow. Gulp will speed up your development workflow. Gulp will speed up your development workflow.',
61+
imageUrl: 'http://brunch.io/images/others/gulp.png'
62+
}]
63+
};
64+
65+
var element = React.createElement(ThumbnailList, options);
66+
React.render(element, document.querySelector('.container'));
67+
</script>

0 commit comments

Comments
 (0)