From 892a99eca60bddab6ae827d950d7c30eff323b94 Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Wed, 4 Nov 2020 12:43:15 +1300 Subject: [PATCH] add + expander in place of collapser. --- webclient/src/Comments.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/webclient/src/Comments.js b/webclient/src/Comments.js index 633b6f5..1e02d8d 100644 --- a/webclient/src/Comments.js +++ b/webclient/src/Comments.js @@ -72,7 +72,7 @@ class Article extends React.Component { } displayComment(story, c, level) { - const cid = c.author+c.date; + const cid = c.author + c.date; const collapsed = this.state.collapsed.includes(cid); const expanded = this.state.expanded.includes(cid); @@ -85,19 +85,22 @@ class Article extends React.Component {

{c.author === story.author ? '[OP]' : ''} {c.author || '[Deleted]'} - {' '} | {moment.unix(c.date).fromNow()} + {' '} | {moment.unix(c.date).fromNow()} - {hidden || hasChildren && - this.collapseComment(cid)}>– - } + {hasChildren && ( + hidden ? + this.collapseComment(cid)}>– + : + this.expandComment(cid)}>+ + )}

-
+
{hidden && hasChildren ? -
this.expandComment(cid)}>[show {this.countComments(c)-1} more]
- : +
this.expandComment(cid)}>[show {this.countComments(c) - 1} more]
+ : c.comments.map(i => this.displayComment(story, i, level + 1)) }
@@ -130,7 +133,7 @@ class Article extends React.Component { {story.comments.map(c => this.displayComment(story, c, 0))}
- : + :

loading...

}