@@ -7,6 +7,8 @@ import getDocument from '../../shims/document';
77import getWindow from '../../shims/window' ;
88import { noop , defaultStatusFormatter , isKeyboardEvent } from './utils' ;
99import { AnimationHandler , CarouselProps , CarouselState } from './types' ;
10+ import Arrow from './Arrow' ;
11+ import Indicator from './Indicator' ;
1012import {
1113 slideAnimationHandler ,
1214 slideSwipeAnimationHandler ,
@@ -43,29 +45,18 @@ export default class Carousel extends React.Component<CarouselProps, CarouselSta
4345 onSwipeMove : ( ) => false ,
4446 preventMovementUntilSwipeScrollTolerance : false ,
4547 renderArrowPrev : ( onClickHandler : ( ) => void , hasPrev : boolean , label : string ) => (
46- < button type = "button" aria-label = { label } className = { klass . ARROW_PREV ( ! hasPrev ) } onClick = { onClickHandler } />
48+ < Arrow direction = "prev" onClickHandler = { onClickHandler } enabled = { hasPrev } label = { label } />
4749 ) ,
4850 renderArrowNext : ( onClickHandler : ( ) => void , hasNext : boolean , label : string ) => (
49- < button type = "button" aria-label = { label } className = { klass . ARROW_NEXT ( ! hasNext ) } onClick = { onClickHandler } />
51+ < Arrow direction = "next" onClickHandler = { onClickHandler } enabled = { hasNext } label = { label } />
5052 ) ,
5153 renderIndicator : (
5254 onClickHandler : ( e : React . MouseEvent | React . KeyboardEvent ) => void ,
5355 isSelected : boolean ,
5456 index : number ,
5557 label : string
5658 ) => {
57- return (
58- < li
59- className = { klass . DOT ( isSelected ) }
60- onClick = { onClickHandler }
61- onKeyDown = { onClickHandler }
62- value = { index }
63- key = { index }
64- role = "button"
65- tabIndex = { 0 }
66- aria-label = { `${ label } ${ index + 1 } ` }
67- />
68- ) ;
59+ return < Indicator onClickHandler = { onClickHandler } isSelected = { isSelected } index = { index } label = { label } /> ;
6960 } ,
7061 renderItem : ( item : React . ReactNode ) => {
7162 return item ;
0 commit comments