@@ -161,7 +161,7 @@ export const InfiniteWithOnly2Slides = {
161161 slideHeight : '300px'
162162 } ,
163163 render : ( args ) => (
164- < Carousel { ...args } >
164+ < Carousel { ...args } >
165165 < img src = 'http://picsum.photos/325/300' alt = 'A sample' />
166166 < img src = 'http://picsum.photos/350/300' alt = 'A sample' />
167167 </ Carousel >
@@ -176,7 +176,7 @@ export const InfiniteWithOnly1Slide = {
176176 dots : false
177177 } ,
178178 render : ( args ) => (
179- < Carousel { ...args } >
179+ < Carousel { ...args } >
180180 < img src = 'http://picsum.photos/325/300' alt = 'A sample' />
181181 </ Carousel >
182182 )
@@ -191,7 +191,7 @@ export const AutoplayWithBackgroundImages = {
191191 autoplay : true
192192 } ,
193193 render : ( args ) => (
194- < Carousel { ...args } >
194+ < Carousel { ...args } >
195195 < div style = { {
196196 backgroundImage : 'url(http://picsum.photos/600/300)' ,
197197 backgroundSize : 'cover' ,
@@ -231,7 +231,7 @@ export const BackgroundImagesWithFade = {
231231 arrows : true
232232 } ,
233233 render : ( args ) => (
234- < Carousel { ...args } >
234+ < Carousel { ...args } >
235235 < div style = { {
236236 backgroundImage : 'url(http://picsum.photos/600/300)' ,
237237 backgroundSize : 'cover' ,
@@ -292,35 +292,37 @@ export const CustomDotsComponent = {
292292 }
293293} ;
294294
295- export const AddImages = {
296- render : ( ) => {
297- const [ images , setImages ] = useState ( [ IMAGES [ 0 ] ] ) ;
295+ const AddImagesComponent = ( ) => {
296+ const [ images , setImages ] = useState ( [ IMAGES [ 0 ] ] ) ;
298297
299- const addImage = ( ) => {
300- if ( images . length < IMAGES . length ) {
301- setImages ( images . concat ( IMAGES [ images . length ] ) ) ;
302- }
303- } ;
298+ const addImage = ( ) => {
299+ if ( images . length < IMAGES . length ) {
300+ setImages ( images . concat ( IMAGES [ images . length ] ) ) ;
301+ }
302+ } ;
304303
305- return (
306- < Fragment >
307- < Carousel
308- width = '450px'
309- cellPadding = { 5 }
310- infinite = { true }
311- dots = { false }
312- arrows = { false }
313- autoplay = { false }
314- controls = { [ { component : CustomDots , props : { title : 'My Slides' } , position : 'top' } ] }
315- >
316- {
317- images . map ( ( image , index ) => < img key = { index } src = { image } alt = 'A sample' /> )
318- }
319- </ Carousel >
320- < button onClick = { addImage } > Add Image</ button >
321- </ Fragment >
322- ) ;
323- }
304+ return (
305+ < Fragment >
306+ < Carousel
307+ width = '450px'
308+ cellPadding = { 5 }
309+ infinite = { true }
310+ dots = { false }
311+ arrows = { false }
312+ autoplay = { false }
313+ controls = { [ { component : CustomDots , props : { title : 'My Slides' } , position : 'top' } ] }
314+ >
315+ {
316+ images . map ( ( image , index ) => < img key = { index } src = { image } alt = 'A sample' /> )
317+ }
318+ </ Carousel >
319+ < button onClick = { addImage } > Add Image</ button >
320+ </ Fragment >
321+ ) ;
322+ } ;
323+
324+ export const AddImages = {
325+ render : AddImagesComponent
324326} ;
325327
326328export const LeftAlignedSlides = {
@@ -350,7 +352,7 @@ export const Rtl = {
350352 } ,
351353 render : ( args ) => (
352354 < div dir = 'rtl' >
353- < Carousel { ...args } />
355+ < Carousel { ...args } />
354356 </ div >
355357 )
356358} ;
0 commit comments