Do not show thread toolbar when empty
The toolbar is now not shown when there isn't any switch inside.
Also, the spacing has been improved to match the original spacing when
the toolbar is not shown.
Bug: twpowertools:153
Change-Id: I1263659ef6a1abc63d38b2f644fdf0a60fa032d8
diff --git a/src/contentScripts/communityConsole/threadToolbar/components/index.js b/src/contentScripts/communityConsole/threadToolbar/components/index.js
index ce8da4d..36df710 100644
--- a/src/contentScripts/communityConsole/threadToolbar/components/index.js
+++ b/src/contentScripts/communityConsole/threadToolbar/components/index.js
@@ -19,11 +19,16 @@
css`${unsafeCSS(consoleCommonStyles)}`,
css`
:host {
+ display: block;
+ padding-top: 1rem;
+ }
+
+ .toolbar {
display: flex;
flex-flow: row wrap;
align-items: center;
row-gap: 0.5rem;
- padding-top: 1.5rem;
+ padding-top: 0.5rem;
padding-left: 0.25rem;
padding-right: 0.25rem;
padding-bottom: 0.5rem;
@@ -71,9 +76,14 @@
}
render() {
+ // NOTE: Keep this in sync!
+ if (!this.options.flattenthreads) return nothing;
+
return html`
- ${this.renderBadge()}
- ${this.renderFlattenRepliesSwitch()}
+ <div class="toolbar">
+ ${this.renderBadge()}
+ ${this.renderFlattenRepliesSwitch()}
+ </div>
`;
}