mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
refactoring of layout finished
This commit is contained in:
@@ -4,12 +4,12 @@ export default class FlexContainer extends BasicWidget {
|
||||
constructor(direction) {
|
||||
super();
|
||||
|
||||
if (!direction) {
|
||||
throw new Error(`Direction argument missing, use either 'row' or 'column'`);
|
||||
if (!direction || !['row', 'column'].includes(direction)) {
|
||||
throw new Error(`Direction argument given as "${direction}", use either 'row' or 'column'`);
|
||||
}
|
||||
|
||||
this.attrs = {
|
||||
style: 'display: flex;'
|
||||
style: `display: flex; flex-direction: ${direction};`,
|
||||
};
|
||||
|
||||
this.children = [];
|
||||
@@ -25,13 +25,8 @@ export default class FlexContainer extends BasicWidget {
|
||||
return this;
|
||||
}
|
||||
|
||||
rowFlex() {
|
||||
this.css('flex-direction', 'row');
|
||||
return this;
|
||||
}
|
||||
|
||||
columnFlex() {
|
||||
this.css('flex-direction', 'column');
|
||||
collapsible() {
|
||||
this.css('min-height', '0');
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -40,10 +35,6 @@ export default class FlexContainer extends BasicWidget {
|
||||
return this;
|
||||
}
|
||||
|
||||
child(widgetFactory) {
|
||||
this.children = widgetFactory(this);
|
||||
}
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(`<div>`);
|
||||
|
||||
@@ -55,8 +46,6 @@ export default class FlexContainer extends BasicWidget {
|
||||
this.$widget.attr(key, this.attrs[key]);
|
||||
}
|
||||
|
||||
if (!this.children)
|
||||
|
||||
for (const widget of this.children) {
|
||||
this.$widget.append(widget.render());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user