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

21 lines
575 B
JavaScript
Raw Normal View History

2021-05-17 21:46:18 +02:00
import BasicWidget from "./basic_widget.js";
2021-05-24 22:29:49 +02:00
const TPL = `<div class="spacer"></div>`;
2021-05-17 21:46:18 +02:00
export default class SpacerWidget extends BasicWidget {
constructor(baseSize = 0, growIndex = 1000, shrinkIndex = 1000) {
2021-05-24 22:29:49 +02:00
super();
this.baseSize = baseSize;
2021-05-24 22:29:49 +02:00
this.growIndex = growIndex;
this.shrinkIndex = shrinkIndex;
2021-05-24 22:29:49 +02:00
}
2021-05-17 21:46:18 +02:00
doRender() {
this.$widget = $(TPL);
this.$widget.css("flex-basis", this.baseSize);
this.$widget.css("flex-grow", this.growIndex);
this.$widget.css("flex-shrink", this.shrinkIndex);
2021-05-17 21:46:18 +02:00
}
}