Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit 9d6b075

Browse files
committed
add simple es5 non-jsx example
1 parent e1c9f21 commit 9d6b075

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

example-es5/index.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>React dat.GUI Demo</title>
6+
<link href="../build/react-dat-gui.min.css" rel="stylesheet" />
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script src="https://fb.me/react-15.1.0.js"></script>
11+
<script src="https://fb.me/react-dom-15.1.0.js"></script>
12+
<script src="../build/react-dat-gui.min.js"></script>
13+
<script>
14+
15+
var DatFactory = React.createFactory(ReactDatGui.default);
16+
var DatStringFactory = React.createFactory(ReactDatGui.DatString);
17+
var DatNumberFactory = React.createFactory(ReactDatGui.DatNumber);
18+
var DatBooleanFactory = React.createFactory(ReactDatGui.DatBoolean);
19+
20+
var App = React.createClass({
21+
22+
getInitialState: function() {
23+
return {
24+
data: {
25+
string: 'Hello World',
26+
number: 66,
27+
boolean: false
28+
}
29+
};
30+
},
31+
32+
handleUpdate: function(data) {
33+
console.log('handleUpdate', data);
34+
this.setState({
35+
data: data
36+
});
37+
},
38+
39+
render: function() {
40+
return DatFactory({ data: this.state.data, onUpdate: this.handleUpdate }, [
41+
DatStringFactory({ path: 'string', label: 'String', key: 1 }),
42+
DatNumberFactory({ path: 'number', label: 'Number', min: 0, max: 100, step: 1, key: 2 }),
43+
DatBooleanFactory({ path: 'boolean', label: 'Boolean', key: 3 }),
44+
]);
45+
}
46+
47+
});
48+
49+
var AppFactory = React.createFactory(App);
50+
51+
ReactDOM.render(
52+
AppFactory(),
53+
document.getElementById('app')
54+
);
55+
56+
</script>
57+
</body>
58+
</html>

0 commit comments

Comments
 (0)