Skip to content

Commit ccc7c2f

Browse files
committed
added render method for headline
1 parent bffe9b2 commit ccc7c2f

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

packages/uui-dialog-layout/lib/uui-dialog-layout.element.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ export class UUIDialogLayoutElement extends LitElement {
3838
(e.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;
3939
};
4040

41+
/**
42+
* Renders a h3 with the headline slot nested
43+
* @returns {TemplateResult}
44+
* @protected
45+
* @method
46+
*/
47+
protected renderHeadline() {
48+
return html` <h3
49+
style=${this._headlineSlotHasContent || this.headline !== null
50+
? ''
51+
: 'display: none'}>
52+
${this.headline}
53+
<slot name="headline" @slotchange=${this._headlineSlotChanged}></slot>
54+
</h3>`;
55+
}
56+
4157
/**
4258
* Renders default slot
4359
* @returns {TemplateResult}
@@ -59,15 +75,7 @@ export class UUIDialogLayoutElement extends LitElement {
5975
}
6076

6177
render() {
62-
return html`
63-
<h3
64-
style=${this._headlineSlotHasContent || this.headline !== null
65-
? ''
66-
: 'display: none'}>
67-
${this.headline}
68-
<slot name="headline" @slotchange=${this._headlineSlotChanged}></slot>
69-
</h3>
70-
${this.renderContent()} ${this.renderActions()}
71-
`;
78+
return html`${this.renderHeadline()} ${this.renderContent()}
79+
${this.renderActions()} `;
7280
}
7381
}

0 commit comments

Comments
 (0)