Skip to content

Commit f3ceb65

Browse files
committed
Performance: Reduce layout shifts
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
1 parent a027a20 commit f3ceb65

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/components/image.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ const Image = ({ childImageSharp, extension, publicURL, alt, imgStyle, ...rest }
66
if (!childImageSharp && extension === "svg") {
77
return (
88
<div className="old-gatsby-image-wrapper" style={{ width: "100%", height: "auto", aspectRatio: "16/9" }}>
9-
<img
10-
src={publicURL}
11-
alt={alt || "Blog image"}
12-
width="100%"
9+
<img
10+
src={publicURL}
11+
alt={alt || "Blog image"}
12+
width="100%"
1313
height="auto"
14-
style={{
15-
aspectRatio: "16/9",
14+
style={{
15+
aspectRatio: "16/9",
1616
objectFit: imgStyle?.objectFit || "cover",
17-
...imgStyle
18-
}}
17+
...imgStyle
18+
}}
1919
/>
2020
</div>
2121
);
2222
}
2323

2424
return <GatsbyImage
25-
key={publicURL}
26-
image={childImageSharp?.gatsbyImageData}
25+
key={publicURL}
26+
image={childImageSharp?.gatsbyImageData}
2727
alt={alt || "Blog image"}
28-
{...rest}
28+
{...rest}
2929
/>;
3030
};
3131

0 commit comments

Comments
 (0)