Files
Iris/src/js/components/AlbumGrid.js

39 lines
822 B
JavaScript
Raw Normal View History

import React, { PropTypes } from 'react'
2016-10-25 14:09:53 +13:00
import GridItem from './GridItem'
export default class AlbumGrid extends React.Component{
constructor(props) {
super(props);
}
render(){
2016-10-25 21:36:33 +13:00
if( this.props.albums ){
2016-10-26 08:51:28 +13:00
var className = "grid album-grid"
if( this.props.className ) className += ' '+this.props.className
return (
2016-10-26 08:51:28 +13:00
<div className={className}>
{
2016-10-25 21:36:33 +13:00
this.props.albums.map(
(album, index) => {
2016-10-31 16:49:42 +13:00
// handle nested album objects (as in Album Library)
if( album.album ){
var flatAlbum = album.album;
flatAlbum.added_at = album.added_at;
album = flatAlbum;
}
return <GridItem item={album} key={index} link={'/album/'+album.uri} />
}
)
}
2016-10-26 08:51:28 +13:00
</div>
);
}
return null;
}
}