Skip to content

Commit c3f7c77

Browse files
committed
tooling - part 2
1 parent 3ac4d7c commit c3f7c77

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed

thumbnail-gulp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

thumbnail-gulp/application.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
});

thumbnail-gulp/gulpfile.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var gulp = require('gulp');
2+
var react = require('gulp-react');
3+
var concat = require('gulp-concat');
4+
5+
gulp.task('default', function() {
6+
return gulp.src('src/**')
7+
.pipe(react())
8+
.pipe(concat('application.js'))
9+
.pipe(gulp.dest('./'));
10+
});

thumbnail-gulp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<head>
22
<script src="http://fb.me/react-0.13.0.js"></script>
3-
<script src="http://fb.me/JSXTransformer-0.13.0.js"></script>
3+
<script src="application.js"></script>
44
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
55
</head>
66
<body>

thumbnail-gulp/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "thumbnail-gulp",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1"
7+
},
8+
"author": "",
9+
"license": "ISC",
10+
"dependencies": {
11+
"gulp": "^3.8.11",
12+
"gulp-concat": "^2.5.2",
13+
"gulp-react": "^3.0.1",
14+
"react": "^0.13.1"
15+
},
16+
"devDependencies": {}
17+
}

0 commit comments

Comments
 (0)