-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (78 loc) · 1.84 KB
/
index.html
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Example Comfey bind-class</title>
</head>
<body>
<h1>Comfey Example MultiApp</h1>
<div class="apps">
<div id="app1">
<h2>App1</h2>
<div>
<div class="active-check" data-bind-class="stateActive::active">
Green if active
</div>
</div>
<div>
<div
class="dynamic-class-check"
data-bind-class="fontSize::large::large"
>
Font size changes with the state fontSize
</div>
</div>
</div>
<div id="app2">
<h2>App2</h2>
<div>
<div class="active-check" data-bind-class="stateActive::active">
Green if active
</div>
</div>
<div>
<div
class="dynamic-class-check"
data-bind-class="fontSize::large::large"
>
Font size changes with the state fontSize
</div>
</div>
</div>
</div>
<br />
<hr />
<em
>Notes:
<ul>
<li>Multiple app can have duplicate states</li>
<li>they will be scoped within each app</li>
<li>You will have to scope you javascript as well</li>
<li>Just avoid declaring getters and setters globally</li>
</ul>
</em>
<style>
.apps {
display: flex;
}
.apps > div {
width: 50%;
min-height: 300px;
}
.active-check {
color: red;
}
.active {
color: green;
}
.dynamic-class-check {
font-size: 16px;
}
.dynamic-class-check.large {
font-size: 36px;
}
</style>
<script src="./index.js"></script>
</body>
</html>