Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit ce1942d

Browse files
committed
Fix image loading above the fold 🚀
1 parent c44bf76 commit ce1942d

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
2-
All changes to Chicio coding will be documented in this file.
2+
All changes to Chicio Coding will be documented in this file.
3+
4+
## [6.3.3](https://github.com/chicio/chicio.github.io/releases/tag/v6.3.3)
5+
Release date: 2023-09-24
6+
7+
#### Fixed
8+
9+
- Eager flag for images above the fold
310

411
## [6.3.2](https://github.com/chicio/chicio.github.io/releases/tag/v6.3.2)
512
Release date: 2023-09-18

src/components/design-system/molecules/post-authors.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const PostAuthors: FC<PostAuthorsProps> = ({
8787
>
8888
<PostAuthorImage
8989
alt={blogAuthor.name}
90+
loading={"eager"}
9091
image={blogAuthorImage}
9192
style={{
9293
width: 30,

src/components/design-system/molecules/post-card.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const PostCardContainer = styled.div<BigCardProps>`
4848
}
4949
`;
5050

51-
const PostCardImageContainer = styled(GatsbyImage)`
51+
const PostCardImage = styled(GatsbyImage)`
5252
width: 100%;
5353
object-fit: cover;
5454
height: 200px;
@@ -117,9 +117,10 @@ export const PostCard: FC<PostCardProps> = ({
117117
label: tracking.label.body,
118118
}}
119119
>
120-
<PostCardImageContainer
120+
<PostCardImage
121121
alt={title}
122122
image={image}
123+
loading={big ? "eager" : "lazy"}
123124
imgStyle={{
124125
borderRadius: "4px 4px 0 0",
125126
}}

src/components/design-system/organism/blog-header.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export const BlogHeader: FC = () => (
126126
<ImageContainer>
127127
<StaticImage
128128
src={"../../../images/blog-logo.jpg"}
129+
loading={"eager"}
129130
alt={"blog logo"}
130131
width={80}
131132
height={80}

src/components/design-system/organism/profile-presentation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const ProfilePresentation: FC<ProfilePresentationProps> = ({
6464
<ProfileImageContainer>
6565
<StaticImage
6666
placeholder={"none"}
67+
loading={"eager"}
6768
imgStyle={{
6869
width: "130px",
6970
height: "130px",

src/pages/index.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@ import { FC } from "react";
1313
const BottomIndex = loadable(() => import(`../components/bottom-index`));
1414

1515
const HomePage: FC<PageProps> = ({ location }) => {
16-
const data = useStaticQuery<Queries.HomePageQuery>(
17-
graphql`
18-
query HomePage {
19-
site {
20-
siteMetadata {
21-
author
22-
featuredImage
23-
}
16+
const data = useStaticQuery<Queries.HomePageQuery>(graphql`
17+
query HomePage {
18+
site {
19+
siteMetadata {
20+
author
21+
featuredImage
2422
}
2523
}
26-
`
27-
);
28-
const siteMetada = data.site!.siteMetadata!;
29-
const author = siteMetada.author!;
30-
const featuredImage = siteMetada.featuredImage!;
24+
}
25+
`);
26+
const siteMetadata = data.site!.siteMetadata!;
27+
const author = siteMetadata.author!;
28+
const featuredImage = siteMetadata.featuredImage!;
3129

3230
return (
3331
<ShowcasePageTemplate

0 commit comments

Comments
 (0)