Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@saigowthamr
Created May 25, 2018 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save saigowthamr/51a24db8bdf227611faf1f630fb4684c to your computer and use it in GitHub Desktop.
Save saigowthamr/51a24db8bdf227611faf1f630fb4684c to your computer and use it in GitHub Desktop.
import React from 'react';
import moment from 'moment';
import LazyLoad from 'react-lazyload';
import './albums.css'
export default (props)=>{
function formatDate(date, format){
return moment(date).format(format);
};
return(
<ul className="album">
<li className="imgs album-item">
<a href={props.link} target="blank" className="link">
<LazyLoad height={200} >
<img className="album-img"src={props.image} alt={'itunes'+Math.random()} />
</LazyLoad>
</a>
</li>
<li className="title album-item">
<a href={props.link} target="blank" className="link">
{props.title.slice(0,20)}..</a></li>
<li className="price album-item">Price:{props.price}</li>
<li className="date album-item">Released:{formatDate(props.date,"MMM Do YY")}</li>
</ul>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment