File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
- import React , { Component } from 'react' ;
1
+ import React , { Component } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
import cleanProps from 'clean-react-props' ;
4
4
@@ -82,6 +82,7 @@ class Rotator extends Component {
82
82
render ( ) {
83
83
const {
84
84
children,
85
+ component,
85
86
indicator,
86
87
} = this . props ;
87
88
@@ -106,22 +107,26 @@ class Rotator extends Component {
106
107
} )
107
108
: null ;
108
109
109
- return (
110
- < div { ...cleanProps ( this . props ) } >
111
- { clonedChildren }
112
- { clonedIndicator }
113
- </ div >
110
+ return React . createElement ( component , {
111
+ ...cleanProps ( this . props )
112
+ } ,
113
+ [ ...clonedChildren , clonedIndicator ]
114
114
) ;
115
115
}
116
116
}
117
117
118
118
Rotator . propTypes = {
119
+ component : PropTypes . oneOfType ( [
120
+ PropTypes . element ,
121
+ PropTypes . string ,
122
+ ] ) ,
119
123
index : PropTypes . number ,
120
124
indicator : PropTypes . element ,
121
125
onChange : PropTypes . func ,
122
126
} ;
123
127
124
128
Rotator . defaultProps = {
129
+ component : 'div' ,
125
130
index : 0 ,
126
131
onChange : ( ) => { } ,
127
132
} ;
You can’t perform that action at this time.
0 commit comments