-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathBodyFragment.njs
More file actions
55 lines (47 loc) · 1.14 KB
/
BodyFragment.njs
File metadata and controls
55 lines (47 loc) · 1.14 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import Nullstack from 'nullstack'
class BodyFragment extends Nullstack {
count = 0
visible = false
objected = false
increment() {
this.count++
}
reveal() {
this.visible = !this.visible
}
countDataKeys({ data }) {
this.hasDataKeys = Object.keys(data).length > 0
}
render() {
return (
<body
data-chars="a"
onclick={[this.increment, this.countDataKeys, { objected: true }]}
data-count={this.count}
class={['class-one', 'class-two', false]}
style="background-color: black;"
data-keys={this.hasDataKeys}
data-hydrated={this.hydrated}
>
<body
data-chars="b"
data-numbers="0"
data-count={this.count}
onclick={this.reveal}
class="class-three class-four"
style="color: white;"
data-objected={this.objected}
>
BodyFragment
</body>
{this.visible && (
<body data-visible data-has-visible={this.hasDataVisible}>
BodyFragment2
</body>
)}
<a href="/">home</a>
</body>
)
}
}
export default BodyFragment