2016-07-07 23:23:18 +02:00
|
|
|
import React, { Component, PropTypes } from "react";
|
2016-07-29 23:57:21 +02:00
|
|
|
import CSSModules from "react-css-modules";
|
2016-07-07 23:23:18 +02:00
|
|
|
|
|
|
|
import { AlbumRow } from "./Album";
|
|
|
|
|
2016-07-29 23:57:21 +02:00
|
|
|
import css from "../styles/Artist.scss";
|
|
|
|
|
|
|
|
class ArtistCSS extends Component {
|
2016-07-07 23:23:18 +02:00
|
|
|
render () {
|
2016-08-05 00:00:25 +02:00
|
|
|
let albumsRows = [];
|
|
|
|
if (this.props.artist.get("albums").size > 0) {
|
|
|
|
const artistAlbums = this.props.albums;
|
|
|
|
const artistSongs = this.props.songs;
|
|
|
|
this.props.artist.get("albums").forEach(function (album) {
|
|
|
|
album = artistAlbums.get(album);
|
|
|
|
const songs = album.get("tracks").map(
|
|
|
|
id => artistSongs.get(id)
|
|
|
|
);
|
|
|
|
albumsRows.push(<AlbumRow album={album} songs={songs} key={album.get("id")} />);
|
2016-07-07 23:23:18 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<div>
|
2016-07-29 23:57:21 +02:00
|
|
|
<div className="row" styleName="name">
|
2016-07-27 13:51:30 +02:00
|
|
|
<div className="col-sm-12">
|
2016-08-05 00:00:25 +02:00
|
|
|
<h1>{this.props.artist.get("name")}</h1>
|
2016-07-07 23:23:18 +02:00
|
|
|
<hr/>
|
2016-07-27 13:51:30 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="col-sm-9">
|
2016-08-05 00:00:25 +02:00
|
|
|
<p>{this.props.artist.get("summary")}</p>
|
2016-07-07 23:23:18 +02:00
|
|
|
</div>
|
2016-07-27 13:51:30 +02:00
|
|
|
<div className="col-sm-3 text-center">
|
2016-08-05 00:00:25 +02:00
|
|
|
<p><img src={this.props.artist.get("art")} width="200" height="200" className="img-responsive img-circle" styleName="art" alt={this.props.artist.get("name")}/></p>
|
2016-07-07 23:23:18 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{ albumsRows }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-05 00:00:25 +02:00
|
|
|
// TODO: Not object
|
2016-07-29 23:57:21 +02:00
|
|
|
ArtistCSS.propTypes = {
|
2016-08-05 00:00:25 +02:00
|
|
|
artist: PropTypes.object.isRequired,
|
|
|
|
albums: PropTypes.object.isRequired,
|
|
|
|
songs: PropTypes.object.isRequired
|
2016-07-07 23:23:18 +02:00
|
|
|
};
|
2016-07-29 23:57:21 +02:00
|
|
|
|
|
|
|
export default CSSModules(ArtistCSS, css);
|