Skip to content

Commit

Permalink
fix(ideal-image): do not pass down img prop (#8250)
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 authored and slorber committed Oct 28, 2022
1 parent 31c9920 commit 4c964c6
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,19 @@ function getMessage(icon: IconKey, state: State) {
}

export default function IdealImage(props: Props): JSX.Element {
const {alt, className, img} = props;
const {img, ...propsRest} = props;

// In dev env just use regular img with original file
if (typeof img === 'string' || 'default' in img) {
return (
<img
src={typeof img === 'string' ? img : img.default}
className={className}
alt={alt}
{...props}
/>
// eslint-disable-next-line jsx-a11y/alt-text
<img src={typeof img === 'string' ? img : img.default} {...propsRest} />
);
}

return (
<ReactIdealImage
{...props}
alt={alt}
className={className}
{...propsRest}
height={img.src.height ?? 100}
width={img.src.width ?? 100}
placeholder={{lqip: img.preSrc}}
Expand Down

0 comments on commit 4c964c6

Please sign in to comment.