-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPanel.js
33 lines (27 loc) · 837 Bytes
/
Panel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { createElement, Text, Wrapper } from './createElement'
import { Timeline, Animation } from './animation'
import { ease } from './cubicBezier'
export class Panel {
constructor(config) {
this.children = [];
this.attributes = new Map();
this.properties = new Map();
}
setAttribute(name, value) {
this[name] = value;
}
appendChild(child) {
this.children.push(child)
}
render() {
return <div class="panel" style="border:solid 1px lightgreen; width: 300px;">
<h1 style="background-color: lightgreen; width: 300px; margin: 0">{this.title}</h1>
<div style="width: 300px; min-height:300px">
{this.children}
</div>
</div>;
}
mountTo(parent) {
this.render().mountTo(parent)
}
}