|
| 1 | +var options = { |
| 2 | + thumbnailData: [{ |
| 3 | + title: 'Show Courses', |
| 4 | + number: 12, |
| 5 | + header: 'Learn React', |
| 6 | + 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.', |
| 7 | + imageUrl: 'https://raw.githubusercontent.com/wiki/facebook/react/react-logo-1000-transparent.png' |
| 8 | + },{ |
| 9 | + title: 'Show Courses', |
| 10 | + number: 25, |
| 11 | + header: 'Learn Gulp', |
| 12 | + description: 'Gulp will speed up your development workflow. Gulp will speed up your development workflow. Gulp will speed up your development workflow.', |
| 13 | + imageUrl: 'http://brunch.io/images/others/gulp.png' |
| 14 | + }] |
| 15 | +}; |
| 16 | + |
| 17 | +var element = React.createElement(ThumbnailList, options); |
| 18 | +React.render(element, document.querySelector('.container')); |
| 19 | + |
| 20 | +var Badge = React.createClass({displayName: "Badge", |
| 21 | + render: function() { |
| 22 | + return React.createElement("button", {className: "btn btn-primary", type: "button"}, |
| 23 | + this.props.title, " ", React.createElement("span", {className: "badge"}, this.props.number) |
| 24 | + ) |
| 25 | + } |
| 26 | +}); |
| 27 | + |
| 28 | +var ThumbnailList = React.createClass({displayName: "ThumbnailList", |
| 29 | + render: function() { |
| 30 | + var list = this.props.thumbnailData.map(function(thumbnailProps){ |
| 31 | + return React.createElement(Thumbnail, React.__spread({}, thumbnailProps)) |
| 32 | + }); |
| 33 | + |
| 34 | + return React.createElement("div", null, |
| 35 | + list |
| 36 | + ) |
| 37 | + } |
| 38 | +}); |
| 39 | + |
| 40 | +var Thumbnail = React.createClass({displayName: "Thumbnail", |
| 41 | + render: function() { |
| 42 | + return React.createElement("div", {className: "col-sm-6 col-md-4"}, |
| 43 | + React.createElement("div", {className: "thumbnail"}, |
| 44 | + React.createElement("img", {src: this.props.imageUrl, alt: "..."}), |
| 45 | + React.createElement("div", {className: "caption"}, |
| 46 | + React.createElement("h3", null, this.props.header), |
| 47 | + React.createElement("p", null, this.props.description), |
| 48 | + React.createElement("p", null, |
| 49 | + React.createElement(Badge, {title: this.props.title, number: this.props.number}) |
| 50 | + ) |
| 51 | + ) |
| 52 | + ) |
| 53 | + ) |
| 54 | + } |
| 55 | +}); |
0 commit comments