This repository was archived by the owner on Feb 27, 2019. It is now read-only.
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
69 lines (65 loc) · 1.59 KB
/
Copy pathindex.html
File metadata and controls
69 lines (65 loc) · 1.59 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
<!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="http://cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react-dom.js"></script>
<script src="./build/react-countdown-clock.js"></script>
<script>
var MAX = 30;
var MIN = 5;
var randomAmountOfSeconds = function(){
return Math.floor( Math.random() * ( MAX - MIN + 1) + MIN )
}
var randomColor = function(){
return '#' + ( Math.random() * 0xFFFFFF << 0 ).toString(16);
}
var Demo = React.createClass({
displayName: 'Demo',
getState: function(){
return {
seconds: 300,
color: randomColor()
}
},
getInitialState: function(){
return this.getState();
},
handleOnComplete: function(){
this.setState(this.getState());
},
render: function(){
return (
React.createElement(ReactCountdownClock, {
seconds: this.state.seconds,
color: this.state.color,
alpha: 0.9,
onComplete: this.handleOnComplete
})
)
}
});
ReactDOM.render(
React.createElement(Demo, null),
document.getElementById('parappa')
)
</script>
</body>
</html>