diff --git a/js/component/common.js b/js/component/common.js index a751d4d8c..41a10c97b 100644 --- a/js/component/common.js +++ b/js/component/common.js @@ -113,3 +113,36 @@ var Address = React.createClass({ ); } }); + +var Thumbnail = React.createClass({ + _defaultImageUri: '/img/default-thumb.svg', + _maxLoadTime: 10000, + + propTypes: { + src: React.PropTypes.string.isRequired, + }, + handleError: function() { + if (this.state.imageUrl != this._defaultImageUri) { + this.setState({ + imageUri: this._defaultImageUri, + }); + } + }, + getInitialState: function() { + return { + imageUri: this.props.src || this._defaultImageUri, + }; + }, + componentDidMount: function() { + setTimeout(() => { + if (!this.refs.img.complete) { + this.setState({ + imageUri: this._defaultImageUri, + }); + } + }, this._maxLoadTime); + }, + render: function() { + return + }, +}); diff --git a/js/page/discover.js b/js/page/discover.js index 239525b0e..e8344d35a 100644 --- a/js/page/discover.js +++ b/js/page/discover.js @@ -113,7 +113,7 @@ var SearchResultRow = React.createClass({
- {'Photo +
@@ -201,7 +201,7 @@ var FeaturedContentItem = React.createClass({ } return (
-
); diff --git a/js/page/my_files.js b/js/page/my_files.js index ea9ca10e4..9b35a05e1 100644 --- a/js/page/my_files.js +++ b/js/page/my_files.js @@ -115,7 +115,7 @@ var MyFilesRow = React.createClass({
- {'Photo +

{this.props.pending ? this.props.title : {this.props.title}}

diff --git a/js/page/show.js b/js/page/show.js index 939095575..3c99ea4bb 100644 --- a/js/page/show.js +++ b/js/page/show.js @@ -31,7 +31,7 @@ var FormatItem = React.createClass({ return (
- {'Photo +

{description}