-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex2.html
86 lines (77 loc) · 2.06 KB
/
ex2.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
<!DOCTYPE html>
<html>
<head>
<script src="./lib/react.js"></script>
<script src="./lib/JSXTransformer.js"></script>
<link rel="stylesheet" type="text/css" href="./lib/bootstrap.min.css">
<style>
.item {
height: 200px;
background-color: #dddddd;
margin: 20px 20px;
padding-top: 20px;
}
.mobile {
width: 400px;
}
body {
text-align: center;
}
</style>
</head>
<body>
<h2>Here desktop: </h2>
<div id="desktop"></div>
<hr/>
<h2>Here mobile: </h2>
<div id="mobile"></div>
<script type="text/jsx">
var Header = React.createClass({
render: function() {
return <div className="item">
<h1>Header</h1>
</div>;
}
});
var Section = React.createClass({
render: function() {
return <div className="item">Section</div>;
}
});
var Footer = React.createClass({
render: function() {
return <div className="item">Footer</div>;
}
});
var Desktop = React.createClass({
render: function() {
return <div>
<Header/>
<div className="row">
<div className="col-md-4">
<Section/>
</div>
<div className="col-md-4">
<Section/>
</div>
<div className="col-md-4">
<Section/>
</div>
</div>
<Footer/>
</div>;
}
});
var Mobile = React.createClass({
render: function() {
return <div className="mobile">
<Header/>
<Section/>
</div>;
}
});
React.render(<Desktop/>, document.getElementById("desktop"));
React.render(<Mobile/>, document.getElementById("mobile"));
</script>
</body>
</html>