Skip to content

Commit

Permalink
few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arinde Eniola committed Oct 4, 2015
1 parent 1b4b361 commit b7bca11
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ var EGiphy = React.createClass({
})
},

//handle giphy search request from the
// search bar
handleSubmit: function(refs) {
var searchValue = React.findDOMNode(refs).value;
if(/^\s*[A-Za-z]+(?:\s+[A-Za-z]+)*\s*$/.test(searchValue)) {
Expand All @@ -79,8 +81,10 @@ var EGiphy = React.createClass({
var display;
// Check if the is internet connection, if not show
// error message, if connection load giphys
// TODO: Make this dry during the next iteration
if(this.state.connection) {
// If no giphy is found, display message
// TODO: remove this shit, it is not DRY!
if(this.state.noGiphyFound) {
display = (
<div className="mdl-cell mdl-cell--12-col giphy-view">
Expand Down
4 changes: 2 additions & 2 deletions app/js/components/Giphy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('../../css/style.css');

var Giphy = React.createClass({

copyLikeToCliboard: function() {
copyLinkToCliboard: function() {
clipboard.writeText(this.props.src.original.url);
this.props.showSnackBar();
},
Expand All @@ -14,7 +14,7 @@ var Giphy = React.createClass({
return (
<img
src={this.props.src.fixed_height_downsampled.url}
onClick={this.copyLikeToCliboard}
onClick={this.copyLinkToCliboard}
className="giphy-image"/>
);
}
Expand Down
10 changes: 5 additions & 5 deletions app/js/components/GiphyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ var GiphyView = React.createClass({
* else show giphys
*/
var gifs = [],
showDiv
showSpinner,
self = this;

if(!this.props.giphys.length) {
showDiv = ""
showSpinner = ""
}
else {
showDiv = "show-div"
showSpinner = "show-div"
gifs = this.props.giphys.map(function(gif, index) {
return (
<div className="grid-item" key={'giphy-' + index}>
Expand All @@ -46,7 +46,7 @@ var GiphyView = React.createClass({
});
}

//This is bad, find a better way!
// TODO: This is bad, find a better way!
setTimeout(function() {
this.addMasonryLayout()
}.bind(this), 500);
Expand All @@ -56,7 +56,7 @@ var GiphyView = React.createClass({
<div className="help-text">
<span>CLICK ON IMAGE TO COPY LINK TO CLIPBOARD</span>
</div>
<div className={"load8 " + showDiv}>
<div className={"load8 " + showSpinner}>
<div className="loader">Loading...</div>
</div>
<div className="grid">
Expand Down
2 changes: 1 addition & 1 deletion app/js/stores/GiphyStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var GiphyStore = assign({}, EventEmitter.prototype, {
AppDispatcher.register(function(action) {

switch(action.actionType) {
//what the fuck is this!
//what the fuck is this, make it dry!
case "LOAD_TRENDING_GIPHYS":
giphys = action.data;
GiphyStore.emitLoadGiphys();
Expand Down

0 comments on commit b7bca11

Please sign in to comment.