Skip to content

Instantly share code, notes, and snippets.

@ColeTownsend
Last active April 1, 2017 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColeTownsend/b3412e71eb8ed117e60ed48d6e4d05f4 to your computer and use it in GitHub Desktop.
Save ColeTownsend/b3412e71eb8ed117e60ed48d6e4d05f4 to your computer and use it in GitHub Desktop.
The Post component
import React, { PropTypes } from 'react';
import moment from 'moment';
export default class Post extends React.Component {
constructor (props) {
super(props);
}
render () {
const {
id,
description,
name,
thumbnails,
link,
created_at,
} = this.props.post;
const collectionId = this.props.post.collection_id;
return (
<div
key={id}
>
<div>
<img alt={name} src={thumbnails.large} />
</div>
<div>
<div>
{link
? <a href={link}>
<h3>{name}</h3>
</a>
: <h3>{name}</h3>
}
</div>
<h5>Added {moment(created_at).fromNow()}</h5>
{description &&
<div>
<p>{description}</p>
</div>
}
</div>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment