the whole view is now composed from a single root widget

This commit is contained in:
zadam
2020-02-06 21:16:02 +01:00
parent 8d49249ed7
commit 92f6558e55
5 changed files with 98 additions and 120 deletions

View File

@@ -0,0 +1,29 @@
import BasicWidget from "./basic_widget.js";
export default class FlexContainer extends BasicWidget {
constructor(appContext, attrs, widgets) {
super(appContext);
this.attrs = attrs;
this.children = widgets;
}
render() {
this.$widget = $(`<div style="display: flex;">`);
for (const key in this.attrs) {
if (key === 'id') {
this.$widget.attr(key, this.attrs[key]);
}
else {
this.$widget.css(key, this.attrs[key]);
}
}
for (const widget of this.children) {
this.$widget.append(widget.render());
}
return this.$widget;
}
}