Skip to content

Commit b3822d2

Browse files
authored
feat: Make layout parts overwriteable (openscd#1692)
1 parent 287d0f0 commit b3822d2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

packages/openscd/src/addons/Layout.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,27 @@ export class OscdLayout extends LitElement {
404404
slot="navigationIcon"
405405
@click=${() => (this.menuUI.open = true)}
406406
></mwc-icon-button>
407-
<div slot="title" id="title">${this.docName}</div>
408-
${this.menu.map(this.renderActionItem)}
407+
${this.renderTitle()}
408+
${this.renderActionItems()}
409409
</mwc-top-app-bar-fixed>`;
410410
}
411411

412+
/**
413+
* Renders the title section in the top bar
414+
* Make sure to use slot="title" for the returned template
415+
*/
416+
protected renderTitle(): TemplateResult {
417+
return html`<div slot="title" id="title">${this.docName}</div>`;
418+
}
419+
420+
/**
421+
* Renders the action items for the top bar
422+
* Make sure to use slot="actionItems" for each element
423+
*/
424+
protected renderActionItems(): TemplateResult {
425+
return html`${this.menu.map(this.renderActionItem)}`;
426+
}
427+
412428
protected renderMenuContent(): TemplateResult {
413429
return html`
414430
<div id="menuContent">

0 commit comments

Comments
 (0)