@@ -8,7 +8,7 @@ import DefaultLeftArrow from './LeftArrow';
8
8
import SliderWrapper from './SliderWrapper' ;
9
9
import SliderList from './SliderList' ;
10
10
import Dots from './Dots' ;
11
- import Dot from './Dot' ;
11
+ import DefaultDot from './Dot' ;
12
12
13
13
class Slider extends React . Component {
14
14
constructor ( props ) {
@@ -86,16 +86,16 @@ class Slider extends React.Component {
86
86
87
87
renderDots ( ) {
88
88
const dots = [ ] ;
89
- const { children } = this . props ;
89
+ const { children, Dot } = this . props ;
90
90
const numberOfChildren = children ? children . length || 1 : 0 ;
91
91
let i ;
92
92
for ( i = 0 ; i <= numberOfChildren - this . state . cardsToShow ; i += 1 ) {
93
93
const index = i ;
94
- dots . push ( < Dot
95
- active = { index === this . state . initialCard }
96
- key = { i }
97
- onClick = { ( ) => this . changeInitialCard ( index ) }
98
- /> ) ;
94
+ dots . push ( React . cloneElement ( Dot , {
95
+ active : index === this . state . initialCard ,
96
+ key : index ,
97
+ onClick : ( ) => this . changeInitialCard ( index ) ,
98
+ } ) ) ;
99
99
}
100
100
return dots ;
101
101
}
@@ -145,6 +145,7 @@ Slider.defaultProps = {
145
145
showArrows : true ,
146
146
LeftArrow : < DefaultLeftArrow /> ,
147
147
RightArrow : < DefaultRightArrow /> ,
148
+ Dot : < DefaultDot /> ,
148
149
cardsToShow : null ,
149
150
afterSlide : null ,
150
151
beforeSlide : null ,
@@ -153,6 +154,7 @@ Slider.defaultProps = {
153
154
Slider . propTypes = {
154
155
LeftArrow : PropTypes . node ,
155
156
RightArrow : PropTypes . node ,
157
+ Dot : PropTypes . node ,
156
158
showArrows : PropTypes . bool ,
157
159
showDots : PropTypes . bool ,
158
160
children : PropTypes . node . isRequired ,
0 commit comments