import ImmutablePropTypes from 'react-immutable-proptypes'; const hostStyle = { display: 'block', marginTop: '5px', fontSize: '13px' }; const getHostname = url => { const parser = document.createElement('a'); parser.href = url; return parser.hostname; }; class Card extends React.PureComponent { render () { const { card } = this.props; if (card === null) { return null; } let image = ''; if (card.get('image')) { image = (
{card.get('title')}
); } return ( {image}
{card.get('title')}

{card.get('description').substring(0, 50)}

{getHostname(card.get('url'))}
); } } Card.propTypes = { card: ImmutablePropTypes.map }; export default Card;