-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
117 lines (109 loc) · 2.36 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Layout architect</title>
<link rel="stylesheet" href="./la.css">
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-family: 16px;
}
section {
display: grid;
grid-template-columns: 1fr 1fr;
max-width: 900px;
margin: 0 auto;
}
section + section {
margin-top: 2em;
}
#container {
margin: 0 auto;
width: 300px;
height: 300px;
border: solid 1px #999;
border-radius: 4px;
padding: 0.5em;
}
h1 {
margin-top: 2em;
margin-bottom: 2em;
padding: 0;
text-align: center;
}
h2 {
text-align: center;
}
#result {
font-size: 0.9em;
}
footer {
margin-top: 4em;
margin-bottom: 4em;
text-align: center;
}
.centered-content {
max-width: 900px;
margin: 4em auto;
}
</style>
</head>
<body>
<h1>Layout architect</h1>
<section>
<div id="container"></div>
<div id="result"></div>
</section>
<div class="centered-content">
<h2>Usage</h2>
<pre>
const la = LayoutArchitect(
document.querySelector('#container'),
['editor', 'output', 'console', 'notes']
);
la.onChange(layout => {
// layout
});
la.change(
// new layout here
);
</pre>
</div>
<footer>
<p>
Documentation: <a href="https://github.com/krasimir/layout-architect">github.com/krasimir/layout-architect</a>
</p>
</footer>
<script src="./la.js"></script>
<script>
const initialLayout = {
"name": "editor",
"elements": []
};
const result = document.querySelector('#result');
const la = LayoutArchitect(
document.querySelector('#container'),
['editor', 'output', 'console', 'notes'],
initialLayout
);
la.onChange(layout => {
if (layout) {
result.innerHTML = '<pre>' + JSON.stringify(layout, null, 2) + '</pre>';
} else {
result.innerHTML = '';
}
});
result.innerHTML = '<pre>' + JSON.stringify(initialLayout, null, 2) + '</pre>';
</script>
</body>
</html>