-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(gatsby-codemods): Update to match new image API (#29004)
* update codemod for new API * uncomment
- Loading branch information
LB
authored
Jan 13, 2021
1 parent
87bdec0
commit 2c6c42c
Showing
10 changed files
with
113 additions
and
27 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...by-codemods/src/transforms/__testfixtures__/gatsby-plugin-image/call-expression.output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/gatsby-codemods/src/transforms/__testfixtures__/gatsby-plugin-image/fluid.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react" | ||
import { graphql } from "gatsby" | ||
import Img from "gatsby-image" | ||
|
||
<Img fixed={data.file.childImageSharp.fixed} alt="headshot"/> | ||
|
||
export const query = graphql` | ||
{ | ||
file(relativePath: { eq: "headers/default.jpg" }) { | ||
childImageSharp { | ||
fluid(maxWidth: 1000) { | ||
...GatsbyImageSharpFluid | ||
} | ||
} | ||
} | ||
other: file(relativePath: { eq: "headers/default.jpg" }) { | ||
childImageSharp { | ||
fluid(maxWidth: 500) { | ||
...GatsbyImageSharpFluid | ||
} | ||
} | ||
} | ||
} | ||
` |
19 changes: 19 additions & 0 deletions
19
packages/gatsby-codemods/src/transforms/__testfixtures__/gatsby-plugin-image/fluid.output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react" | ||
import { graphql } from "gatsby" | ||
import { GatsbyImage } from "gatsby-plugin-image"; | ||
|
||
<GatsbyImage image={data.file.childImageSharp.gatsbyImageData} alt="headshot" /> | ||
|
||
export const query = graphql`{ | ||
file(relativePath: {eq: "headers/default.jpg"}) { | ||
childImageSharp { | ||
gatsbyImageData(layout: FULL_WIDTH) | ||
} | ||
} | ||
other: file(relativePath: {eq: "headers/default.jpg"}) { | ||
childImageSharp { | ||
gatsbyImageData(width: 500, layout: CONSTRAINED) | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...gatsby-codemods/src/transforms/__testfixtures__/gatsby-plugin-image/variable-src.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Img from "gatsby-image" | ||
const HomePage = ({ data }) => { | ||
const image = data.file.childImageSharp.fluid.src | ||
} |
4 changes: 4 additions & 0 deletions
4
...atsby-codemods/src/transforms/__testfixtures__/gatsby-plugin-image/variable-src.output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { GatsbyImage } from "gatsby-plugin-image"; | ||
const HomePage = ({ data }) => { | ||
const image = data.file.childImageSharp.gatsbyImageData.src | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters