Modified time to PublishingInfo

This commit is contained in:
Jori Lallo
2016-06-05 15:00:14 -07:00
parent 6303bc9279
commit 9a2d0c18d8
3 changed files with 11 additions and 4 deletions

View File

@@ -27,9 +27,10 @@ class Document extends React.Component {
return (
<div className={ styles.container }>
<PublishingInfo
avatarUrl={ this.props.document.user.avatarUrl }
document={ this.props.document }
name={ this.props.document.user.name }
timestamp={ this.props.document.createdAt }
createdAt={ this.props.document.createdAt }
updatedAt={ this.props.document.updatedAt }
/>
<DocumentHtml html={ this.props.document.html } />
</div>

View File

@@ -18,7 +18,7 @@ class Document extends React.Component {
<PublishingInfo
avatarUrl={ this.props.document.user.avatarUrl }
name={ this.props.document.user.name }
timestamp={ document.createdAt }
createdAt={ document.createdAt }
/>
<Link

View File

@@ -12,6 +12,11 @@ const PublishingInfo = (props) => {
<Avatar src={ props.avatarUrl } size={ 24 } />
<span className={ styles.userName }>
{ props.name } published { moment(props.timestamp).fromNow() }
{ props.createdAt !== props.updatedAt ? (
<span>
&nbsp;and modified { moment(props.timestamp).fromNow() }
</span>
) : null }
</span>
</Flex>
);
@@ -20,7 +25,8 @@ const PublishingInfo = (props) => {
PublishingInfo.propTypes = {
avatarUrl: React.PropTypes.string.isRequired,
name: React.PropTypes.string.isRequired,
timestamp: React.PropTypes.string.isRequired,
createdAt: React.PropTypes.string.isRequired,
updatedAt: React.PropTypes.string.isRequired,
};
export default PublishingInfo;