Skip to content

Commit 56668a1

Browse files
committed
Flux - 23 - Filtering Image Data
1 parent b61d75e commit 56668a1

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

imgur-client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"gulp-server-livereload": "^1.3.0",
1717
"gulp-util": "^3.0.4",
1818
"gulp-watch": "^4.2.4",
19+
"lodash": "^3.10.0",
1920
"node-notifier": "^4.2.1",
2021
"react": "^0.13.3",
2122
"react-router": "^1.0.0-beta2",

imgur-client/sass/image-preview.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.image-preview {
2+
display: inline-block;
3+
4+
img {
5+
height: 200px;
6+
width: 200px;
7+
display: inline-block;
8+
}
9+
}

imgur-client/sass/topic.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.topic {
2+
text-align: center;
3+
}

imgur-client/src/components/image-preview.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var React = require('react');
22

33
module.exports = React.createClass({
44
render: function() {
5-
return <div>
5+
return <div className="image-preview">
66
{this.image()}
77
</div>
88
},

imgur-client/src/components/topic.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = React.createClass({
2020
Actions.getImages(nextProps.params.id);
2121
},
2222
render: function() {
23-
return <div>
23+
return <div className="topic">
2424
{this.renderImages()}
2525
</div>
2626
},

imgur-client/src/stores/image-store.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
var Reflux = require('reflux');
22
var Api = require('../utils/api');
33
var Actions = require('../actions');
4+
var _ = require('lodash');
45

56
module.exports = Reflux.createStore({
67
listenables: [Actions],
78
getImages: function(topicId){
89
Api.get('topics/' + topicId)
910
.then(function(json){
10-
this.images = json.data;
11+
this.images = _.reject(json.data, function(image) {
12+
return image.is_album
13+
});
14+
1115
this.triggerChange();
1216
}.bind(this));
1317
},

0 commit comments

Comments
 (0)