Skip to content

Commit

Permalink
Merge pull request #1150 from ethereum/image-optimization
Browse files Browse the repository at this point in the history
Add eager loading to hero images
  • Loading branch information
samajammin authored Jun 29, 2020
2 parents b720516 + 27c1ec7 commit 714f6c7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 47 deletions.
48 changes: 17 additions & 31 deletions src/pages/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ const BuildPage = ({ data }) => {
<Button to="https://studio.ethereum.org">
<Translation id="page-build-try-button" />
</Button>
<Gif src={studioGif} />
<Gif src={studioGif} loading="eager" alt="Ethereum Studio preview" />
<Caption>
<Translation id="page-build-powered-by" />{" "}
<Link to="https://superblocks.com">Superblocks</Link>
Expand Down Expand Up @@ -326,49 +326,35 @@ const BuildPage = ({ data }) => {

export default BuildPage

export const logoImage = graphql`
fragment logoImage on File {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
}
`

export const query = graphql`
query {
zeroX: file(relativePath: { eq: "build/0x.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...logoImage
}
chainshot: file(relativePath: { eq: "build/chainshot.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...logoImage
}
consensys: file(relativePath: { eq: "build/consensys.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...logoImage
}
cryptoZombie: file(relativePath: { eq: "build/crypto-zombie.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...logoImage
}
oz: file(relativePath: { eq: "build/oz.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...logoImage
}
remix: file(relativePath: { eq: "build/remix.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...logoImage
}
}
`
31 changes: 15 additions & 16 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ const HomePage = ({ data }) => {
<Hero
fluid={data.hero.childImageSharp.fluid}
alt="Ethereum.org hero image"
loading="eager"
/>
<Content>
{contentVersion > 1.1 && (
Expand Down Expand Up @@ -400,35 +401,33 @@ const HomePage = ({ data }) => {

export default HomePage

export const personaImage = graphql`
fragment personaImage on File {
childImageSharp {
fixed(height: 100) {
...GatsbyImageSharpFixed
}
}
}
`

export const query = graphql`
query {
hero: file(relativePath: { eq: "home/hero.png" }) {
childImageSharp {
fluid(maxWidth: 1440, quality: 100) {
fluid(maxWidth: 1440) {
...GatsbyImageSharpFluid
}
}
}
individuals: file(relativePath: { eq: "home/cats.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...personaImage
}
developers: file(relativePath: { eq: "home/developers.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...personaImage
}
enterprise: file(relativePath: { eq: "home/enterprise.png" }) {
childImageSharp {
fixed(height: 100, quality: 100) {
...GatsbyImageSharpFixed
}
}
...personaImage
}
}
`

0 comments on commit 714f6c7

Please sign in to comment.