Created
April 5, 2017 19:33
-
-
Save codeaholicguy/1e594eaf16aa19bf29b01e17cd6125ac 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
import React, {PropTypes, Component} from 'react'; | |
export default class Track extends Component { | |
static propTypes = { | |
track: PropTypes.object.isRequired, | |
play: PropTypes.func.isRequired | |
} | |
_play() { | |
this.props.play(this.props.track); | |
} | |
render() { | |
const {origin: {artwork_url, title}} = this.props.track | |
return ( | |
<div className='track'> | |
<img src={artwork_url} /> | |
{title} | |
<button onClick={() => this._play()} type='button'>Play</button> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment