Skip to content

Commit

Permalink
wc: Add rightContent property to tool-header and deprecate rhs #TASK-…
Browse files Browse the repository at this point in the history
…7216 #TASK-7100
  • Loading branch information
jmjuanes committed Jan 7, 2025
1 parent 99f6166 commit 135c1d5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/webcomponents/commons/tool-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ export default class ToolHeader extends LitElement {
class: {
type: String
},
rightContent: {
type: Object,
},
// 'rhs' is deprecated, use 'rightContent' instead
rhs: {
type: Object
}
},
};
}

Expand All @@ -59,6 +63,10 @@ export default class ToolHeader extends LitElement {
}
}

renderContent(content) {
return (typeof content === "function") ? content() : content;
}

render() {
return html`
<div class="d-flex align-items-center my-3 py-2 ${this.class ?? ""}">
Expand All @@ -69,9 +77,9 @@ export default class ToolHeader extends LitElement {
${this.subtitle ? html`
<h3>${this.subtitle}</h3>
` : nothing}
<div class="ms-auto">
${this.rhs}
</div>
${(this.rightContent || this.rhs) ? html`
<div class="ms-auto">${this.renderContent(this.rightContent || this.rhs)}</div>
` : nothing}
</div>
`;
}
Expand Down

0 comments on commit 135c1d5

Please sign in to comment.