Skip to content

Commit dd84f19

Browse files
committed
Add click comment to collapse it
1 parent 3ec235c commit dd84f19

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mixins/CommentMixin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var CommentMixin = {
3737

3838
renderCommentLoading(comment) {
3939
return <div className={'Comment Comment--loading Comment--level' + this.props.level}>
40-
{(this.props.loadingSpinner || comment.delayed) && <Spinner size="20"/>}
40+
{(this.props.loadingSpinner || comment.delayed) && <Spinner size="20" />}
4141
{comment.delayed && <div className="Comment__text">
4242
Unable to load comment &ndash; this usually indicates the author has configured a delay.
4343
Trying again in 30 seconds.
@@ -96,7 +96,7 @@ var CommentMixin = {
9696
{options.collapsible && this.renderCollapseControl(options.collapsed)}
9797
{options.collapsible && ' '}
9898
<Link to={`/user/${comment.by}`} className="Comment__user">{comment.by}</Link>{' '}
99-
<TimeAgo date={comment.time * 1000}/>
99+
<TimeAgo date={comment.time * 1000} />
100100
{options.link && ' | '}
101101
{options.link && <Link to={`/comment/${comment.id}`}>link</Link>}
102102
{options.parent && ' | '}
@@ -112,8 +112,8 @@ var CommentMixin = {
112112
},
113113

114114
renderCommentText(comment, options) {
115-
return <div className="Comment__text">
116-
{(!comment.dead || SettingsStore.showDead) ? <div dangerouslySetInnerHTML={{__html: comment.text}}/> : '[dead]'}
115+
return <div className="Comment__text" onClick={this.toggleCollapse} >
116+
{(!comment.dead || SettingsStore.showDead) ? <div dangerouslySetInnerHTML={{ __html: comment.text }} /> : '[dead]'}
117117
{SettingsStore.replyLinks && options.replyLink && !comment.dead && <p>
118118
<a href={`https://news.ycombinator.com/reply?id=${comment.id}`}>reply</a>
119119
</p>}

0 commit comments

Comments
 (0)