@@ -2,52 +2,10 @@ import React, { Component } from "react";
2
2
import PropTypes from 'prop-types' ;
3
3
4
4
export default class CountdownTimer extends Component {
5
- static propTypes = {
6
- className : PropTypes . string ,
7
- count : PropTypes . number ,
8
- border : PropTypes . bool ,
9
- showTitle : PropTypes . bool ,
10
- direction : PropTypes . oneOf ( [ 'right' , 'left' ] ) ,
11
- noPoints : PropTypes . bool ,
12
- responsive : PropTypes . bool ,
13
- color : PropTypes . string ,
14
- backgroundColor : PropTypes . string ,
15
- size : PropTypes . number ,
16
- labelSize : PropTypes . number ,
17
- hideDay : PropTypes . bool ,
18
- hideHours : PropTypes . bool ,
19
- dayTitle : PropTypes . string ,
20
- hourTitle : PropTypes . string ,
21
- minuteTitle : PropTypes . string ,
22
- secondTitle : PropTypes . string ,
23
- onEnd : PropTypes . func ,
24
- } ;
25
-
26
- static defaultProps = {
27
- count : 0 ,
28
- border : false ,
29
- showTitle : false ,
30
- direction : 'left' ,
31
- noPoints : false ,
32
- color : '#000' ,
33
- backgroundColor : '#fff' ,
34
- responsive : false ,
35
- size : 18 ,
36
- labelSize : 12 ,
37
- hideDay : false ,
38
- hideHours : false ,
39
- dayTitle : 'Day' ,
40
- hourTitle : 'Hour' ,
41
- minuteTitle : 'Min' ,
42
- secondTitle : 'Sec' ,
43
- className : '' ,
44
- onEnd : ( ) => { } ,
45
- } ;
46
-
47
5
constructor ( props ) {
48
6
super ( props ) ;
49
7
this . state = {
50
- count : props . count ,
8
+ count : parseInt ( props . count , 10 ) ,
51
9
} ;
52
10
}
53
11
@@ -173,11 +131,55 @@ export default class CountdownTimer extends Component {
173
131
174
132
render ( ) {
175
133
const { count } = this . state ;
176
- const { className } = this . props ;
134
+ const { className, id } = this . props ;
177
135
return (
178
- < div className = { `root-react-component-countdown-timer ${ className } ` } >
136
+ < div className = { `root-react-component-countdown-timer ${ className } ` } id = { id } >
179
137
< div className = "displayedTime" > { this . format ( count ) } </ div >
180
138
</ div >
181
139
) ;
182
140
}
183
141
}
142
+
143
+ CountdownTimer . propTypes = {
144
+ className : PropTypes . string ,
145
+ id : PropTypes . string ,
146
+ count : PropTypes . number ,
147
+ border : PropTypes . bool ,
148
+ showTitle : PropTypes . bool ,
149
+ direction : PropTypes . oneOf ( [ 'right' , 'left' ] ) ,
150
+ noPoints : PropTypes . bool ,
151
+ responsive : PropTypes . bool ,
152
+ color : PropTypes . string ,
153
+ backgroundColor : PropTypes . string ,
154
+ size : PropTypes . number ,
155
+ labelSize : PropTypes . number ,
156
+ hideDay : PropTypes . bool ,
157
+ hideHours : PropTypes . bool ,
158
+ dayTitle : PropTypes . string ,
159
+ hourTitle : PropTypes . string ,
160
+ minuteTitle : PropTypes . string ,
161
+ secondTitle : PropTypes . string ,
162
+ onEnd : PropTypes . func ,
163
+ } ;
164
+
165
+ CountdownTimer . defaultProps = {
166
+ count : 0 ,
167
+ border : false ,
168
+ showTitle : false ,
169
+ direction : 'left' ,
170
+ noPoints : false ,
171
+ color : '#000' ,
172
+ backgroundColor : '#fff' ,
173
+ responsive : false ,
174
+ size : 18 ,
175
+ labelSize : 12 ,
176
+ hideDay : false ,
177
+ hideHours : false ,
178
+ dayTitle : 'Day' ,
179
+ hourTitle : 'Hour' ,
180
+ minuteTitle : 'Min' ,
181
+ secondTitle : 'Sec' ,
182
+ className : '' ,
183
+ id : '' ,
184
+ onEnd : ( ) => { } ,
185
+ } ;
0 commit comments