-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.js
More file actions
66 lines (59 loc) · 2.26 KB
/
application.js
File metadata and controls
66 lines (59 loc) · 2.26 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
var options = {
thumbnailData: [{
title: 'Show Courses',
number: 12,
header: 'Learn React',
description: 'React is a fantastic new frontend framework. React is a fantastic new frontend framework.',
imageUrl: 'https://facebook.github.io/react/img/logo.svg'
}, {
title: 'Show Courses',
number: 25,
header: 'Learn Gulp',
description: 'Gulp will speed up your development workflow. Gulp will speed up your development workflow. Gulp will speed up your development workflow.',
imageUrl: 'https://avatars0.githubusercontent.com/u/6200624?v=3&s=400'
}, {
title: 'Show Courses',
number: 43,
header: 'Learn Angular',
description: 'Angular is a lousy framework by Google',
imageUrl: 'http://www.w3schools.com/angular/pic_angular.jpg'
}]
};
// React, please render this class
var element = React.createElement(ThumbnailList, options);
// React, after you render this class, please place it in my body tag
React.render(element, document.querySelector('.target'));
var Badge = React.createClass({displayName: "Badge",
render: function() {
return React.createElement("button", {className: "btn btn-primary", type: "button"},
this.props.title, " ", React.createElement("span", {className: "badge"}, this.props.number)
)
}
});
var Thumbnail = require('thumbnail');
var ThumbnailList = React.createClass({displayName: "ThumbnailList",
render: function() {
var list = this.props.thumbnailData.map(function(thumbnailProps) {
return React.createElement(Thumbnail, React.__spread({}, thumbnailProps))
});
return React.createElement("div", null,
list
)
}
});
var Thumbnail = React.createClass({displayName: "Thumbnail",
render: function() {
return React.createElement("div", {className: "col-sm-4 col-md-4"},
React.createElement("div", {className: "thumbnail"},
React.createElement("img", {src: this.props.imageUrl}),
React.createElement("div", {className: "caption"},
React.createElement("h3", null, this.props.header),
React.createElement("p", null, this.props.description),
React.createElement("p", null,
React.createElement(Badge, {title: this.props.title, number: this.props.number})
)
)
)
)
}
});