diff --git a/src/webcomponents/commons/tool-header.js b/src/webcomponents/commons/tool-header.js index f121247a9..06c3a5ad7 100644 --- a/src/webcomponents/commons/tool-header.js +++ b/src/webcomponents/commons/tool-header.js @@ -14,15 +14,11 @@ * limitations under the License. */ -import {LitElement, html} from "lit"; +import {LitElement, html, nothing} from "lit"; import UtilsNew from "../../core/utils-new.js"; export default class ToolHeader extends LitElement { - constructor() { - super(); - } - createRenderRoot() { return this; } @@ -47,18 +43,33 @@ export default class ToolHeader extends LitElement { }; } + renderIcon() { + if (this.icon) { + if (this.icon.match(/\./)?.length) { + return html` + ${this.title} + `; + } else { + return html` + + `; + } + } else { + return nothing; + } + } + render() { return html` - -
-

- ${this.icon ? this.icon.match(/\./)?.length ? - html`${this.title}` : - html`` : ""} - ${UtilsNew.renderHTML(this.title)} +
+

+ ${this.renderIcon()} + ${UtilsNew.renderHTML(this.title)}

- ${this.subtitle ? html`

${this.subtitle}

` : null} -
+ ${this.subtitle ? html` +

${this.subtitle}

+ ` : nothing} +
${this.rhs}