File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,11 @@ export function ImageSlide({
131131 const sizes =
132132 srcSet && rect && hasWindow ( ) ? `${ Math . round ( Math . min ( estimateActualWidth ( ) , rect . width ) ) } px` : undefined ;
133133
134- const { style : imagePropsStyle , className : imagePropsClassName , ...restImageProps } = imageProps || { } ;
134+ const {
135+ style : imagePropsStyle ,
136+ className : imagePropsClassName ,
137+ ...restImageProps
138+ } = ( typeof imageProps === "function" ? imageProps ( image ) : imageProps ) || { } ;
135139
136140 return (
137141 < >
Original file line number Diff line number Diff line change @@ -180,14 +180,16 @@ export interface CarouselSettings {
180180 /** `object-fit` setting for image slides */
181181 imageFit : ImageFit ;
182182 /** custom image attributes */
183- imageProps : Omit <
184- React . ImgHTMLAttributes < HTMLImageElement > ,
185- "src" | "alt" | "sizes" | "srcSet" | "onLoad" | "onError" | "onClick"
186- > ;
183+ imageProps : ImageProps | ( ( slide : Slide ) => ImageProps ) ;
187184}
188185
189186export type LengthOrPercentage = `${number } px` | `${number } %` | number ;
190187
188+ export type ImageProps = Omit <
189+ React . ImgHTMLAttributes < HTMLImageElement > ,
190+ "src" | "alt" | "sizes" | "srcSet" | "onLoad" | "onError" | "onClick"
191+ > ;
192+
191193/** Animation settings */
192194export interface AnimationSettings {
193195 /** fade-in / fade-out animation settings */
You can’t perform that action at this time.
0 commit comments