Skip to content

Conversation

@ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Feb 22, 2021

Adds documentation for the helper functions getImage, getSrc, getSrcSet and withArtDirection. Also adds clarification on using the plugin with CMSs.

rendered file

[ch24526]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 22, 2021
@ascorbic ascorbic added status: needs docs review Pull request related to documentation waiting for review and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 22, 2021
Copy link
Contributor

@laurieontech laurieontech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Left some suggestions.

**Note:** It is a very good idea to use [the GraphiQL IDE](/docs/how-to/querying-data/running-queries-with-graphiql) when writing your `gatsbyImageData` queries. It includes auto-complete and inline documentation for all of the options and lets you see the generated image data right inside the IDE.
2. **Option values:** In the `StaticImage` component, props such as `layout` and `placeholder` take a _string_, while the resolver takes a _[a GraphQL enum](https://graphql.org/learn/schema/#enumeration-types)_, which is in upper case by convention and is not quoted like a string. Both syntaxes are shown in the reference below.

**Important:** For dynamic images, these options are for the `gatsbyImageData` resolver on [sharp nodes](https://www.gatsbyjs.com/plugins/gatsby-transformer-sharp). If you are using `gatsbyImageData` from a different plugin, such as a CMS or image host, you should refer to that plugin's documentation for the options, as they will differ from these. Static images use sharp under the hood, so these options apply when using the `StaticImage` component too.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the last sentence a bit confusing. If you're using CMS data that'd never be a source for StaticImage, right? Unless it's a URL endpoint in which case would the options be the same?

laurieontech
laurieontech previously approved these changes Feb 25, 2021
@ascorbic ascorbic merged commit aeab2d4 into master Feb 25, 2021
@ascorbic ascorbic deleted the docs/art-direction branch February 25, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs docs review Pull request related to documentation waiting for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants