-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
break up PostInfo into stateless fn components
- Loading branch information
Showing
8 changed files
with
98 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
import React, { PropTypes } from 'react'; | ||
import Link from 'react-router/lib/Link'; | ||
import pluralize from '../util/pluralize'; | ||
|
||
const CommentsLink = ({ postId, commentCount }) => ( | ||
<span className="post-info-item"> | ||
<Link to={ `/post/${postId}` }> | ||
{ pluralize(commentCount, 'comment') } | ||
</Link> | ||
</span> | ||
); | ||
|
||
CommentsLink.PropTypes = { | ||
postId: PropTypes.string, | ||
commentCount: PropTypes.number | ||
}; | ||
|
||
export default CommentsLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
import React, { PropTypes } from 'react'; | ||
import { Link } from 'react-router'; | ||
|
||
const PostCreatorLink = ({ creator }) => ( | ||
<span className="post-info-item"> | ||
<Link to={ `/user/${creator}` }>{ creator }</Link> | ||
</span> | ||
); | ||
|
||
PostCreatorLink.PropTypes = { | ||
creator: PropTypes.string | ||
}; | ||
|
||
export default PostCreatorLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
import { PropTypes } from 'react'; | ||
import Actions from '../actions/Actions'; | ||
|
||
const PostDeleteLink = ({ post }) => ( | ||
<span className="delete post-info-item"> | ||
<a onClick={ () => Actions.deletePost(post) }>delete</a> | ||
</span> | ||
); | ||
|
||
PostDeleteLink.PropTypes = { | ||
post: PropTypes.object | ||
}; | ||
|
||
export default PostDeleteLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
import React, { PropTypes } from 'react'; | ||
import timeAgo from '../util/timeAgo'; | ||
|
||
const PostTimeAgo = ({ time }) => ( | ||
<span className="post-info-item"> | ||
{ timeAgo(time) } | ||
</span> | ||
); | ||
|
||
PostTimeAgo.PropTypes = { | ||
time: PropTypes.string | ||
}; | ||
|
||
export default PostTimeAgo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters