Skip to content

Instantly share code, notes, and snippets.

@jnsdls
Created September 13, 2016 08:59
Show Gist options
  • Save jnsdls/3eb65273c00d6bccc07e1c9216cc8e92 to your computer and use it in GitHub Desktop.
Save jnsdls/3eb65273c00d6bccc07e1c9216cc8e92 to your computer and use it in GitHub Desktop.
renderCurrentPhoto(){
const { photos, currentAt } = this.props;
const { photoIndex } = this.state;
if(photos.length) {
// if we have photos loaded, render the current one
return <Photo currentAt={currentAt} photo={photos[photoIndex]} nextPhoto={this.handleNextPhoto} />
} else {
return null; // we could add a loader here
}
}
render() {
return (<div className="library">
{this.renderCurrentPhoto()}
<div className="library-controls">
<div className="library-controls--left">
<svg fill="#FFFFFF" height="48" viewBox="0 0 24 24" width="48" onClick={this.prevPhoto}>
</svg>
</div>
<div className="library-controls--center">
<div className="library-controls--take-photo" onClick={this.switchPanel} />
</div>
<div className={`library-controls--right`}>
<svg fill="#FFFFFF" height="48" viewBox="0 0 24 24" width="48" onClick={this.handleNextPhoto}>
</svg>
</div>
</div>
</div>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment