mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-26 18:54:12 +00:00
Use better comment collapse icon, and add text. Fixes #318
This commit is contained in:
parent
40a14b5ebe
commit
0c45d61eeb
|
@ -193,11 +193,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm text-muted"
|
class="btn btn-sm text-muted"
|
||||||
onClick={linkEvent(this, this.handleCommentCollapse)}
|
onClick={linkEvent(this, this.handleCommentCollapse)}
|
||||||
aria-label={
|
aria-label={this.expandText}
|
||||||
this.state.collapsed ? i18n.t("expand") : i18n.t("collapse")
|
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>
|
</button>
|
||||||
{/* This is an expanding spacer for mobile */}
|
{/* This is an expanding spacer for mobile */}
|
||||||
<div className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"></div>
|
<div className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"></div>
|
||||||
|
@ -1232,6 +1235,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
handleCommentCollapse(i: CommentNode) {
|
handleCommentCollapse(i: CommentNode) {
|
||||||
i.state.collapsed = !i.state.collapsed;
|
i.state.collapsed = !i.state.collapsed;
|
||||||
i.setState(i.state);
|
i.setState(i.state);
|
||||||
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleViewSource(i: CommentNode) {
|
handleViewSource(i: CommentNode) {
|
||||||
|
@ -1270,4 +1274,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
|
|
||||||
return `${points} • ${upvotes} • ${downvotes}`;
|
return `${points} • ${upvotes} • ${downvotes}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get expandText(): string {
|
||||||
|
return this.state.collapsed ? i18n.t("expand") : i18n.t("collapse");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue