-
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.
fix(docs): improve image docs from workflow evaluation (#14697)
* add API doc for Gatsby Image, improve API titles * improve content in image docs * add doc on working with GIFs * chore: format * update GIFs page with an animated GIF, for reasons * a few copy tweaks to Gatsby Image API doc * code block tweaks and moving links * add markdown + a11y note to GIFs page * pr feedback from Jason * change warning to a note per feedback * Update docs/docs/using-gatsby-image.md Co-Authored-By: gillkyle <kylerobertgill@gmail.com> * Update docs/docs/gatsby-image.md Co-Authored-By: gillkyle <kylerobertgill@gmail.com> * chore: add example images demonstrating duotone and grayscale in image api * add install code blocks for copy/paste
- Loading branch information
Marcy Sutton
authored
Jun 12, 2019
1 parent
37759db
commit 16f0baf
Showing
12 changed files
with
460 additions
and
13 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
--- | ||
title: Images, Files, and Video | ||
overview: true | ||
title: Images, Files, and Video in Gatsby | ||
--- | ||
|
||
Gatsby provides multiple solutions for adding images, video, and files into your projects. This section will walk you through several common patterns for handling media with Gatsby. | ||
Gatsby provides multiple solutions for adding images, video, and files to your projects. And a pro tip: you don't necessarily have to use GraphQL! From [imports](/docs/importing-assets-into-files/) and use of the [static folder](/docs/static-folder/) to dynamic queries with [Gatsby Image](/docs/using-gatsby-image/) to prevent image bloat, you've got options. | ||
|
||
This section will walk you through several common patterns for handling media with Gatsby, where you can learn about the pros and cons of each method. | ||
|
||
<GuideList slug={props.slug} /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: Working With GIFs | ||
--- | ||
|
||
If you're building a blog with Gatsby, chances are you'll want to include some animated GIFs: who wouldn't want to include a dancing otter or cat GIF? | ||
|
||
## Including GIFs in components | ||
|
||
In Gatsby components and pages, you'll want to import animated GIFs instead of using Gatsby Image because of the way it optimizes image data for the responsive picture element. | ||
|
||
Here's an example: | ||
|
||
```jsx:title=pages/about.js | ||
import React from 'react' | ||
|
||
import Layout from '../components/layout' | ||
import otterGIF from '../gifs/otter.gif' | ||
|
||
const AboutPage = () => ( | ||
return ( | ||
<Layout> | ||
<img src={otterGIF} alt="Otter dancing with a fish" /> | ||
</Layout> | ||
) | ||
) | ||
|
||
export default AboutPage; | ||
``` | ||
|
||
## Including GIFs in Markdown | ||
|
||
In Markdown posts and pages, including an animated GIF is the same as a static image: | ||
|
||
```markdown | ||
![otter dancing with a fish](./images/dancing-ofter.gif) | ||
``` | ||
|
||
![otter dancing with a fish](./images/dancing-otter.gif) | ||
|
||
Animated GIFs can be quite large in size, however, so be careful not to sabotage your webpages' performance with extremely large files. You could reduce file size by [optimizing the frames](https://skylilies.livejournal.com/244378.html) or converting them to video. | ||
|
||
> Note: beware that flashing and autoplaying GIFs can cause accessibility problems. One technique would be to add controls, such as using a package like [react-gif-player](https://www.npmjs.com/package/react-gif-player). |
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