Skip to content

Commit 79e3f1b

Browse files
committed
updated dist example
1 parent 232f938 commit 79e3f1b

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

src/html/test-dist.html.template

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,37 @@
2020
color: #aaa;
2121
font-size:14px;
2222
font-family: monospace;
23+
margin-left: 6px;
24+
}
25+
.react-json-view {
26+
padding: 4px 6px;
27+
border-radius: 3px;
2328
}
2429
</style>
2530
</head>
2631
<body>
2732
<div id="app-container">
2833
<div class="code-comment">// example 1: JSON object</div>
29-
<div id="example1"></div>
34+
<div class="example" id="example1"></div>
3035
<br />
3136
<div class="code-comment">// example 2: array input</div>
32-
<div id="example2"></div>
37+
<div class="example" id="example2"></div>
3338
<br />
3439
<div class="code-comment">// example 3: collapsed by default</div>
35-
<div id="example3"></div>
40+
<div class="example" id="example3"></div>
41+
<br />
42+
<div class="code-comment">// example 4: base-16 monokai theme</div>
43+
<div class="example" id="example4"></div>
44+
<br />
45+
<div class="code-comment">// example 5: base-16 solarized theme</div>
46+
<div class="example" id="example5"></div>
3647
</div>
3748
<script src="https://unpkg.com/react@15/dist/react.js"></script>
3849
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
3950
<script type="text/javascript" src="./main.js"></script>
4051
<style>
4152
#app-container>div{
42-
margin-bottom: 15px;
53+
margin-bottom: 5px;
4354
}
4455
</style>
4556
<script type="text/javascript">
@@ -111,6 +122,54 @@
111122
jsonView3.render(),
112123
document.getElementById('example3')
113124
);
125+
126+
/*-----------EXAMPLE 4-----------*/
127+
//some test JSON
128+
var test_json = {
129+
test: 'this is a test string',
130+
another_sibling: 42,
131+
how_will_array_do: [1, 2, 3, 'test'],
132+
how_will_floats_do: -2.757,
133+
parent: {
134+
sibling1: true,
135+
sibling2: false,
136+
sibling3: null,
137+
'last-sibling': {
138+
grand_child: NaN,
139+
'grand-child-func': (a) => {
140+
let b = a*a;
141+
return b;
142+
}
143+
}
144+
},
145+
string_number: "1234"
146+
};
147+
148+
// reactJsonView is a global variable
149+
var jsonView4 = new reactJsonView.default({
150+
src: test_json,
151+
theme: 'monokai',
152+
name: 'monokai-theme'
153+
});
154+
ReactDOM.render(
155+
jsonView4.render(),
156+
document.getElementById('example4')
157+
);
158+
159+
/*-----------EXAMPLE 5-----------*/
160+
//an example ARRAY
161+
var test_array = [
162+
'you can also display arrays!', 1, 2, 3, {'pretty_cool': true}
163+
];
164+
var jsonView5 = new reactJsonView.default({
165+
src: test_array,
166+
name: 'solarized-array',
167+
theme: 'solarized'
168+
});
169+
ReactDOM.render(
170+
jsonView5.render(),
171+
document.getElementById('example5')
172+
);
114173
</script>
115174
</body>
116175
</html>

0 commit comments

Comments
 (0)