Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quantum-kittens
GitHub Repository: quantum-kittens/platypus
Path: blob/main/frontend/wc/block/block.ts
3858 views
1
// =============================================================================
2
// q-block Component
3
// =============================================================================
4
5
import { CustomElementView, ElementView, register } from '@mathigon/boost';
6
7
const template = '<div class="qb-title"></div><div class="qb-body"><slot></slot></div>';
8
9
@register('q-block', {template})
10
export class QBlock extends CustomElementView {
11
private $title!: ElementView
12
private $body!: ElementView
13
14
ready() {
15
this.$title = this.$('.qb-title')
16
this.$body = this.$('.qb-body')
17
18
if (this.$body.children.length) {
19
const t = this.$body.children.shift()
20
this.$title.append(t)
21
}
22
}
23
}
24
25