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 ( return (
<div className={ styles.container }> <div className={ styles.container }>
<PublishingInfo <PublishingInfo
avatarUrl={ this.props.document.user.avatarUrl } document={ this.props.document }
name={ this.props.document.user.name } 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 } /> <DocumentHtml html={ this.props.document.html } />
</div> </div>

View File

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

View File

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