Notes/src/public/app/widgets/flex_container.js

22 lines
601 B
JavaScript
Raw Normal View History

2020-10-30 22:57:26 +01:00
import AbstractContainer from "./abstract_container.js";
2020-10-30 22:57:26 +01:00
export default class FlexContainer extends AbstractContainer {
2020-02-27 00:58:10 +01:00
constructor(direction) {
super();
2020-02-27 10:03:14 +01:00
if (!direction || !['row', 'column'].includes(direction)) {
throw new Error(`Direction argument given as "${direction}", use either 'row' or 'column'`);
2020-02-27 00:58:10 +01:00
}
this.attrs.style = `display: flex; flex-direction: ${direction};`;
2020-02-27 00:58:10 +01:00
}
doRender() {
2020-02-27 00:58:10 +01:00
this.$widget = $(`<div>`);
for (const widget of this.children) {
this.$widget.append(widget.render());
}
}
2020-07-03 22:27:45 +02:00
}