forked from pughpugh/react-countdown-clock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
59 lines (55 loc) · 1.47 KB
/
Copy pathindex.html
File metadata and controls
59 lines (55 loc) · 1.47 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>react-countdown-clock</title>
<style>
body {
background-color: #CCC;
}
#parappa {
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 300px;
margin: -150px 0 0 -150px;
}
</style>
</head>
<body>
<div id="parappa"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.12.2/JSXTransformer.js"></script>
<script src="./build/react-countdown-clock.js"></script>
<script type="text/jsx">
/** @jsx React.DOM */
var MAX = 30;
var MIN = 5;
randomAmountOfSeconds = function(){
return Math.floor( Math.random() * ( MAX - MIN + 1) + MIN )
}
randomColor = function(){
return '#' + ( Math.random() * 0xFFFFFF << 0 ).toString(16);
}
Demo = React.createClass({
getState: function(){
return {
seconds: randomAmountOfSeconds(),
color: randomColor()
}
},
getInitialState: function(){
return this.getState();
},
handleOnComplete: function(){
this.setState(this.getState());
},
render: function(){
return <ReactCountdownClock seconds={this.state.seconds} color={this.state.color} alpha={0.9} onComplete={this.handleOnComplete} />
}
});
React.render(<Demo />, document.getElementById('parappa'))
</script>
</body>
</html>