Compare commits
3 Commits
d4ae3569ed
...
3522448a7f
| Author | SHA1 | Date | |
|---|---|---|---|
| 3522448a7f | |||
| cb82f80e8e | |||
| 043c4d5aa1 |
@ -1,30 +0,0 @@
|
||||
// components/MergedWidget.ts
|
||||
import { Widget } from './Widget';
|
||||
|
||||
export class MergedWidget extends Widget {
|
||||
private children: Widget[] = [];
|
||||
|
||||
constructor(sizeType: 'default' | 'icon' = 'default') {
|
||||
super(sizeType);
|
||||
}
|
||||
|
||||
addWidget(widget: Widget): void {
|
||||
this.children.push(widget);
|
||||
}
|
||||
|
||||
render(): HTMLElement {
|
||||
// Clear current container contents (in case render is called more than once)
|
||||
this.container.innerHTML = '';
|
||||
|
||||
for (const widget of this.children) {
|
||||
const rendered = widget.render();
|
||||
|
||||
// Move child nodes (not the container itself)
|
||||
while (rendered.firstChild) {
|
||||
this.container.appendChild(rendered.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
return this.container;
|
||||
}
|
||||
}
|
||||
@ -59,7 +59,7 @@ body {
|
||||
}
|
||||
|
||||
.widget-header {
|
||||
font-size: 18px;
|
||||
font-size: 24px;
|
||||
margin-bottom: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user