-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleSPA.html
More file actions
136 lines (125 loc) · 4.3 KB
/
SimpleSPA.html
File metadata and controls
136 lines (125 loc) · 4.3 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://unpkg.com/react@15.3.2/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.3.2/dist/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-router/2.8.1/ReactRouter.min.js"></script>
<style>
body{
background-color: #FFCC00;
padding: 20px;
margin: 0;
}
h1, h2, ul, li{
fint-family: Helvetica, Arial, sans-serif;
}
ul.header li{
display:inline;
list-style-type: none;
margin: 0;
}
ul.header {
background-color: #111;
padding: 0;
}
ul.header li a {
color: #FFF;
font-weight: bold;
text-decoration: none;
padding: 20px;
display: inline-block;
}
.content {
background-color: #FFF;
padding:20px;
}
.content h2 {
padding: 0;
margin: 0;
}
.content li {
mso-margin-bottom: 10px;
}
.active {
background-color: #0099FF;
}
</style>
</head>
<body>
<div id="container">
</div>
<script type="text/babel">
var destinattion = document.querySelector("#container");
var Home = React.createClass({
render: function () {
return(
<div>
<h2>HELLO</h2>
<p> Cras facilisis urna ornare ex volutpat, et cinvallis erat elementum. Ut aliquam, ipsum vitae gravilda suscipit, metus </p>
<p> Duis a turpis sed lacus dapibus elementum sed eu lectus.</p>
</div>
);
}
});
var Contact = React.createClass({
render: function () {
return(
<div>
<h2>GOT QUESTIONS?</h2>
<p>The easiest thing to do is post on our
<a href="http://forum.kirupa.com">forums</a>.
</p>
</div>
);
}
});
var Stuff = React.createClass({
render:function () {
return(
<div>
<h2>STUFF</h2>
<p>Mauris sem velit, vehicula eget sodales vitae, rhoncus eget sapien:</p>
<ol>
<li>Nulla pulvinar diam</li>
<li>Facilisis bibendum</li>
<li>Vestibulm vulputate</li>
<li>Eget erat</li>
<li>Id porttitor</li>
</ol>
</div>
);
}
});
var App = React.createClass({
render: function () {
return (
<div>
<h1>Simple SPA</h1>
<ul className="header">
<li><ReactRouter.IndexLink to="/" activeClassName="active">Home</ReactRouter.IndexLink></li>
<li><ReactRouter.Link to="/stuff" activeClassName="active">Stuff</ReactRouter.Link></li>
<li><ReactRouter.Link to="/contact" activeClassName="active">Contact</ReactRouter.Link></li>
</ul>
<div className="content">
{this.props.children}
</div>
</div>
)
}
});
ReactDOM.render(
<ReactRouter.Router>
<ReactRouter.Route path="/" component={App}>
<ReactRouter.IndexRoute component={Home}/>
<ReactRouter.Route path="stuff" component={Stuff} />
<ReactRouter.Route path="contact" component={Contact} />
</ReactRouter.Route>
</ReactRouter.Router>,
destinattion
);
</script>
</body>
</html>