@@ -11,7 +11,7 @@ import css from './Carousel.css';
1111
1212type Props = {
1313 children : Array < React . Node > ,
14- title : string ,
14+ title ? : string ,
1515 slidesToShow : number ,
1616 withoutControls : boolean ,
1717 dragging : boolean ,
@@ -20,6 +20,7 @@ type Props = {
2020 accessibilityNextLabel : string ,
2121 accessibilityPrevLabel : string ,
2222 infinite ?: boolean ,
23+ titleSize : 'small' | 'large'
2324} ;
2425
2526const Carousel = ( props : Props ) => {
@@ -34,12 +35,16 @@ const Carousel = (props: Props) => {
3435 accessibilityNextLabel,
3536 accessibilityPrevLabel,
3637 infinite,
38+ titleSize,
3739 } = props ;
3840 const [ slideIndex , setSlideIndex ] = React . useState ( 0 ) ;
3941
4042 const renderTopRightControls = ( ) => (
4143 < div className = { css . controls } >
42- < h2 className = { css . title } > { title } </ h2 >
44+ { title && < h2 className = { cx ( css . title , {
45+ [ css . small ] : titleSize === 'small' ,
46+ [ css . large ] : titleSize === 'large'
47+ } ) } > { title } </ h2 > }
4348 { slidesToShow < children . length && (
4449 < div className = { css . buttons } >
4550 < BtnContainer
@@ -114,6 +119,7 @@ Carousel.defaultProps = {
114119 useCenterControls : false ,
115120 accessibilityNextLabel : 'Show next slide' ,
116121 accessibilityPrevLabel : 'Show previous slide' ,
122+ titleSize : 'large'
117123} ;
118124
119125export default Carousel ;
0 commit comments