import React from 'react'; import InfiniteScroll from 'react-infinite-scroller'; import {formatDuration} from './utils.js'; import logo from './logo.svg'; import './AlbumList.css'; function _albumProps(albums, index) { if (index === 0) { return {showArtist: true, showType: true} } if (albums[index-1].artist !== albums[index].artist) { return {showArtist: true, showType: true} } let showType = (albums[index-1].type !== albums[index].type); return {showType}; } function Album({album, showArtist, showType, onPlayAlbum}) { function onClick(album) { return (e) => { e.preventDefault() onPlayAlbum(album) } } return (
{showArtist && (

{album.artist}

)} {showType && (

{album.type}

)}
{album.album}
{album.year} {album.country} {album.track_count} @ {formatDuration(album.total_duration)}
{album.album} {album.publisher} {album.genre}
) } export default function AlbumList({loadMore, hasMore, albums, title, error, ...props}) { return (

{title}

{ error ? (
{error}>
) : ( Loading ...
} initialLoad={false} > {albums.map((album, idx) => ( ))} ) } ) }