Skip to content

Commit

Permalink
fallback to prop sizes if not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Byran Low committed May 31, 2023
1 parent e671519 commit 76ef603
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const Image: React.FC<ImageProps> = ({force, options, ...props}) => {
}
const strippedSrc = props.src.replace(/^\/|\/$/g, '')
const src = getImageSrc(strippedSrc, options)
const sizes = options?.widths ? getSizes(options.widths, options.maxWidth ?? (options.width ? Math.max(options.width, ...options.widths) : Math.max(...options.widths))) : ''
const sizes = options?.widths ? getSizes(options.widths, options.maxWidth ?? (options.width ? Math.max(options.width, ...options.widths) : Math.max(...options.widths))) : props.sizes
const srcSet = getSrcSets(strippedSrc, options)
return <img {...props} src={src} sizes={sizes} srcSet={options?.widths ? srcSet : props.srcSet}/>
}
Expand Down

0 comments on commit 76ef603

Please sign in to comment.