<button
class="btn btn-sm text-muted"
onClick={linkEvent(this, this.handleCommentCollapse)}
- aria-label={
- this.state.collapsed ? i18n.t("expand") : i18n.t("collapse")
- }
+ aria-label={this.expandText}
+ data-tippy-content={this.expandText}
>
- {this.state.collapsed ? "+" : "—"}
+ {this.state.collapsed ? (
+ <Icon icon="plus-square" classes="icon-inline" />
+ ) : (
+ <Icon icon="minus-square" classes="icon-inline" />
+ )}
</button>
{/* This is an expanding spacer for mobile */}
<div className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"></div>
handleCommentCollapse(i: CommentNode) {
i.state.collapsed = !i.state.collapsed;
i.setState(i.state);
+ setupTippy();
}
handleViewSource(i: CommentNode) {
return `${points} • ${upvotes} • ${downvotes}`;
}
+
+ get expandText(): string {
+ return this.state.collapsed ? i18n.t("expand") : i18n.t("collapse");
+ }
}