Created
September 13, 2016 08:59
-
-
Save jnsdls/3eb65273c00d6bccc07e1c9216cc8e92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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