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

Commit

Permalink
Fix image loading above the fold 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
chicio committed Sep 24, 2023
1 parent c44bf76 commit ce1942d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log
All changes to Chicio coding will be documented in this file.
All changes to Chicio Coding will be documented in this file.

## [6.3.3](https://github.com/chicio/chicio.github.io/releases/tag/v6.3.3)
Release date: 2023-09-24

#### Fixed

- Eager flag for images above the fold

## [6.3.2](https://github.com/chicio/chicio.github.io/releases/tag/v6.3.2)
Release date: 2023-09-18
Expand Down
1 change: 1 addition & 0 deletions src/components/design-system/molecules/post-authors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const PostAuthors: FC<PostAuthorsProps> = ({
>
<PostAuthorImage
alt={blogAuthor.name}
loading={"eager"}
image={blogAuthorImage}
style={{
width: 30,
Expand Down
5 changes: 3 additions & 2 deletions src/components/design-system/molecules/post-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const PostCardContainer = styled.div<BigCardProps>`
}
`;

const PostCardImageContainer = styled(GatsbyImage)`
const PostCardImage = styled(GatsbyImage)`
width: 100%;
object-fit: cover;
height: 200px;
Expand Down Expand Up @@ -117,9 +117,10 @@ export const PostCard: FC<PostCardProps> = ({
label: tracking.label.body,
}}
>
<PostCardImageContainer
<PostCardImage
alt={title}
image={image}
loading={big ? "eager" : "lazy"}
imgStyle={{
borderRadius: "4px 4px 0 0",
}}
Expand Down
1 change: 1 addition & 0 deletions src/components/design-system/organism/blog-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const BlogHeader: FC = () => (
<ImageContainer>
<StaticImage
src={"../../../images/blog-logo.jpg"}
loading={"eager"}
alt={"blog logo"}
width={80}
height={80}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const ProfilePresentation: FC<ProfilePresentationProps> = ({
<ProfileImageContainer>
<StaticImage
placeholder={"none"}
loading={"eager"}
imgStyle={{
width: "130px",
height: "130px",
Expand Down
24 changes: 11 additions & 13 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ import { FC } from "react";
const BottomIndex = loadable(() => import(`../components/bottom-index`));

const HomePage: FC<PageProps> = ({ location }) => {
const data = useStaticQuery<Queries.HomePageQuery>(
graphql`
query HomePage {
site {
siteMetadata {
author
featuredImage
}
const data = useStaticQuery<Queries.HomePageQuery>(graphql`
query HomePage {
site {
siteMetadata {
author
featuredImage
}
}
`
);
const siteMetada = data.site!.siteMetadata!;
const author = siteMetada.author!;
const featuredImage = siteMetada.featuredImage!;
}
`);
const siteMetadata = data.site!.siteMetadata!;
const author = siteMetadata.author!;
const featuredImage = siteMetadata.featuredImage!;

return (
<ShowcasePageTemplate
Expand Down

0 comments on commit ce1942d

Please sign in to comment.