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

Removed default aspect-ratio from Image component #5278

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/5096.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the default aspect-ratio from Image component. It was redundant and hard to override. @pnicolli
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ exports[`renders a Lead Image block Sidebar component 1`] = `
sizes="188px"
src="/image.png"
srcSet="/image.png/@@images/image/image-400.png 400w"
style={
Object {
"aspectRatio": "400 / 400",
}
}
width={400}
/>
</div>
Expand Down
4 changes: 0 additions & 4 deletions src/components/theme/Image/Image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export default function Image({
attrs.src = `${baseUrl}${flattenToAppURL(image.download)}`;
attrs.width = image.width;
attrs.height = image.height;
attrs.style = {
aspectRatio: `${image.width} / ${image.height}`,
...imageProps.style,
};
attrs.className = cx(className, { responsive });

if (!isSvg && image.scales && Object.keys(image.scales).length > 0) {
Expand Down
20 changes: 0 additions & 20 deletions src/components/theme/Image/__snapshots__/Image.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ exports[`renders an image component from a catalog brain 1`] = `
height={400}
src="/image/@@images/image/image.png"
srcSet="/image/@@images/image/image-400.png 400w"
style={
Object {
"aspectRatio": "400 / 400",
}
}
width={400}
/>
`;
Expand All @@ -34,11 +29,6 @@ exports[`renders an image component with fetchpriority high 1`] = `
height={400}
src="/image/@@images/image/image.png"
srcSet="/image/@@images/image/image-400.png 400w"
style={
Object {
"aspectRatio": "400 / 400",
}
}
width={400}
/>
`;
Expand All @@ -52,11 +42,6 @@ exports[`renders an image component with lazy loading 1`] = `
loading="lazy"
src="/image/@@images/image/image.png"
srcSet="/image/@@images/image/image-400.png 400w"
style={
Object {
"aspectRatio": "400 / 400",
}
}
width={400}
/>
`;
Expand All @@ -69,11 +54,6 @@ exports[`renders an image component with responsive class 1`] = `
height={400}
src="/image/@@images/image/image.png"
srcSet="/image/@@images/image/image-400.png 400w"
style={
Object {
"aspectRatio": "400 / 400",
}
}
width={400}
/>
`;