Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ideal-image): do not pass down img prop #8250

Merged
merged 2 commits into from Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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