Skip to content

Commit 27c1ec7

Browse files
committed
Add eager loading to hero images
1 parent b720516 commit 27c1ec7

File tree

2 files changed

+32
-47
lines changed

2 files changed

+32
-47
lines changed

src/pages/build.js

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ const BuildPage = ({ data }) => {
284284
<Button to="https://studio.ethereum.org">
285285
<Translation id="page-build-try-button" />
286286
</Button>
287-
<Gif src={studioGif} />
287+
<Gif src={studioGif} loading="eager" alt="Ethereum Studio preview" />
288288
<Caption>
289289
<Translation id="page-build-powered-by" />{" "}
290290
<Link to="https://superblocks.com">Superblocks</Link>
@@ -326,49 +326,35 @@ const BuildPage = ({ data }) => {
326326

327327
export default BuildPage
328328

329+
export const logoImage = graphql`
330+
fragment logoImage on File {
331+
childImageSharp {
332+
fixed(height: 100, quality: 100) {
333+
...GatsbyImageSharpFixed
334+
}
335+
}
336+
}
337+
`
338+
329339
export const query = graphql`
330340
query {
331341
zeroX: file(relativePath: { eq: "build/0x.png" }) {
332-
childImageSharp {
333-
fixed(height: 100, quality: 100) {
334-
...GatsbyImageSharpFixed
335-
}
336-
}
342+
...logoImage
337343
}
338344
chainshot: file(relativePath: { eq: "build/chainshot.png" }) {
339-
childImageSharp {
340-
fixed(height: 100, quality: 100) {
341-
...GatsbyImageSharpFixed
342-
}
343-
}
345+
...logoImage
344346
}
345347
consensys: file(relativePath: { eq: "build/consensys.png" }) {
346-
childImageSharp {
347-
fixed(height: 100, quality: 100) {
348-
...GatsbyImageSharpFixed
349-
}
350-
}
348+
...logoImage
351349
}
352350
cryptoZombie: file(relativePath: { eq: "build/crypto-zombie.png" }) {
353-
childImageSharp {
354-
fixed(height: 100, quality: 100) {
355-
...GatsbyImageSharpFixed
356-
}
357-
}
351+
...logoImage
358352
}
359353
oz: file(relativePath: { eq: "build/oz.png" }) {
360-
childImageSharp {
361-
fixed(height: 100, quality: 100) {
362-
...GatsbyImageSharpFixed
363-
}
364-
}
354+
...logoImage
365355
}
366356
remix: file(relativePath: { eq: "build/remix.png" }) {
367-
childImageSharp {
368-
fixed(height: 100, quality: 100) {
369-
...GatsbyImageSharpFixed
370-
}
371-
}
357+
...logoImage
372358
}
373359
}
374360
`

src/pages/index.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ const HomePage = ({ data }) => {
310310
<Hero
311311
fluid={data.hero.childImageSharp.fluid}
312312
alt="Ethereum.org hero image"
313+
loading="eager"
313314
/>
314315
<Content>
315316
{contentVersion > 1.1 && (
@@ -400,35 +401,33 @@ const HomePage = ({ data }) => {
400401

401402
export default HomePage
402403

404+
export const personaImage = graphql`
405+
fragment personaImage on File {
406+
childImageSharp {
407+
fixed(height: 100) {
408+
...GatsbyImageSharpFixed
409+
}
410+
}
411+
}
412+
`
413+
403414
export const query = graphql`
404415
query {
405416
hero: file(relativePath: { eq: "home/hero.png" }) {
406417
childImageSharp {
407-
fluid(maxWidth: 1440, quality: 100) {
418+
fluid(maxWidth: 1440) {
408419
...GatsbyImageSharpFluid
409420
}
410421
}
411422
}
412423
individuals: file(relativePath: { eq: "home/cats.png" }) {
413-
childImageSharp {
414-
fixed(height: 100, quality: 100) {
415-
...GatsbyImageSharpFixed
416-
}
417-
}
424+
...personaImage
418425
}
419426
developers: file(relativePath: { eq: "home/developers.png" }) {
420-
childImageSharp {
421-
fixed(height: 100, quality: 100) {
422-
...GatsbyImageSharpFixed
423-
}
424-
}
427+
...personaImage
425428
}
426429
enterprise: file(relativePath: { eq: "home/enterprise.png" }) {
427-
childImageSharp {
428-
fixed(height: 100, quality: 100) {
429-
...GatsbyImageSharpFixed
430-
}
431-
}
430+
...personaImage
432431
}
433432
}
434433
`

0 commit comments

Comments
 (0)