Skip to content

Commit

Permalink
Update Gatsby migration guide to use image imports. (#29178)
Browse files Browse the repository at this point in the history
* Update Gatsby migration guide to use image imports.

* Update docs/migrating/from-gatsby.md

* Update docs/migrating/from-gatsby.md

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
3 people committed Sep 19, 2021
1 parent d31bb19 commit 638e6cc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/migrating/from-gatsby.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export function getAllPosts() {

## Image Component and Image Optimization

Since version **10.0.0**, Next.js has a built-in [Image Component and Automatic Image Optimization](/docs/basic-features/image-optimization.md).
Next.js has a built-in [Image Component and Automatic Image Optimization](/docs/basic-features/image-optimization.md).

The Next.js Image Component, [`next/image`](/docs/api-reference/next/image.md), is an extension of the HTML `<img>` element, evolved for the modern web.

Expand All @@ -189,15 +189,24 @@ Instead, use the built-in [`next/image`](/docs/api-reference/next/image.md) comp
```jsx
import Image from 'next/image'
import profilePic from '../public/me.png'

export default function Home() {
return (
<>
<h1>My Homepage</h1>
<Image
src="/me.png"
src={profilePic}
alt="Picture of the author"
// When "responsive", similar to "fluid" from Gatsby
// When "intrinsic", similar to "fluid" with maxWidth from Gatsby
// When "fixed", similar to "fixed" from Gatsby
layout="responsive"
// Optional, similar to "blur-up" from Gatsby
placeholder="blur"
// Optional, similar to "width" in Gatsby GraphQL
width={500}
// Optional, similar to "height" in Gatsby GraphQL
height={500}
/>
<p>Welcome to my homepage!</p>
Expand Down

0 comments on commit 638e6cc

Please sign in to comment.