@@ -12,79 +12,66 @@ import Rect from './custom/Rect'
1212import Circle from './custom/Circle'
1313
1414class ContentLoader extends Component {
15-
16- constructor ( props ) {
17- super ( props )
18-
19- this . state = {
20- style : props . style ,
21- type : props . type ,
22- speed : props . speed ,
23- width : props . width ,
24- height : props . height ,
25- primaryColor : props . primaryColor ,
26- secondaryColor : props . secondaryColor
27- }
28- }
29-
30- render ( ) {
31-
32- if ( this . props . children ) {
33-
34- return (
35- < Wrap { ...this . state } >
36- { this . props . children }
37- </ Wrap >
38- )
39-
40- }
41-
42- if ( ! this . props . children ) {
43-
44- switch ( this . state . type . toLowerCase ( ) ) {
45-
46- case 'instagram' :
47- return < InstagramStyle { ...this . state } />
48- break
49-
50- case 'code' :
51- return < CodeStyle { ...this . state } />
52- break
53-
54- case 'list' :
55- return < ListStyle { ...this . state } />
56- break
57-
58- default :
59- case 'facebook' :
60- return < FacebookStyle { ...this . state } />
61- break
62-
63- }
64-
65- }
66-
67- }
15+ constructor ( props ) {
16+ super ( props )
17+
18+ this . state = {
19+ style : props . style ,
20+ type : props . type ,
21+ speed : props . speed ,
22+ width : props . width ,
23+ height : props . height ,
24+ primaryColor : props . primaryColor ,
25+ secondaryColor : props . secondaryColor ,
26+ }
27+ }
28+
29+ render ( ) {
30+ if ( this . props . children ) {
31+ return < Wrap { ...this . state } > { this . props . children } </ Wrap >
32+ }
33+
34+ if ( ! this . props . children ) {
35+ switch ( this . state . type . toLowerCase ( ) ) {
36+ case 'instagram' :
37+ return < InstagramStyle { ...this . state } />
38+ break
39+
40+ case 'code' :
41+ return < CodeStyle { ...this . state } />
42+ break
43+
44+ case 'list' :
45+ return < ListStyle { ...this . state } />
46+ break
47+
48+ default :
49+ case 'facebook' :
50+ return < FacebookStyle { ...this . state } />
51+ break
52+ }
53+ }
54+ }
6855}
6956
7057ContentLoader . propTypes = {
71- style : PropTypes . object ,
72- type : PropTypes . string ,
73- speed : PropTypes . number ,
74- width : PropTypes . number ,
75- height : PropTypes . number ,
76- primaryColor : PropTypes . string ,
77- secondaryColor : PropTypes . string
58+ style : PropTypes . object ,
59+ type : PropTypes . string ,
60+ speed : PropTypes . number ,
61+ width : PropTypes . number ,
62+ height : PropTypes . number ,
63+ primaryColor : PropTypes . string ,
64+ secondaryColor : PropTypes . string ,
7865}
7966
8067ContentLoader . defaultProps = {
81- type : 'facebook' ,
82- speed : 2 ,
83- width : 400 ,
84- height : 130 ,
85- primaryColor : '#f0f0f0' ,
86- secondaryColor : '#e0e0e0'
68+ type : 'facebook' ,
69+ speed : 2 ,
70+ width : 400 ,
71+ height : 130 ,
72+ primaryColor : '#f0f0f0' ,
73+ secondaryColor : '#e0e0e0' ,
8774}
8875
8976export default ContentLoader
90- export { Rect , Circle }
77+ export { Rect , Circle }
0 commit comments