Last active
January 16, 2019 13:45
-
-
Save 0xtruly/9f201749b13fa6cedc8964783a3dcd4e 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
class Result extends Component { | |
constructor(props){ | |
super(props); | |
this.state = { | |
song: {}, | |
ready: 'initial' | |
} | |
} | |
componentDidMount() { | |
const {match : {params} } = this.props; | |
const song = params; | |
this.setState({ready: 'loaded'}); | |
} | |
render(){ | |
const{song} = this.state; | |
return( | |
<ResultStyle> | |
<Header> | |
<h1>Soundio</h1> | |
<p>The Music Hub</p> | |
<Form /> | |
</Header> | |
<main> | |
<Container> | |
<Grid> | |
{ song.length ? '' : <Loader /> } | |
{ ready === 'loading' ? 'Loading...' : '' } | |
{ song.map(song => ( | |
<Column columns="3" key={song.id}> | |
<MusicList image={song.album.cover_medium ? song.artist.picture_medium:''}> | |
<h3 onClick="pointer"><Link to={`/song/${song.id}`}>{song.artist.name}</Link></h3> | |
<i className="fa fa-music">Album:{song.album.title}</i> <br /> | |
<i className="fa fa-music">Track:{song.title}</i> | |
</MusicList> | |
</Column> | |
)) } | |
</Grid> | |
</Container> | |
</main> | |
<Footer /> | |
</ResultStyle> | |
) | |
} | |
} | |
export default Result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment