Unverified Commit 17a53e27 authored by Steven's avatar Steven Committed by GitHub

Revise image example with layouts near the top (#19161)

This page is useful for testing out layouts so we moved that section to the top.
parent 84716ae6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This example shows how to use the [Image Component in Next.js](https://nextjs.org/docs/api-reference/next/image) serve optimized, responsive images. This example shows how to use the [Image Component in Next.js](https://nextjs.org/docs/api-reference/next/image) serve optimized, responsive images.
The index page ([`pages/index.js`](pages/index.js)) has a couple images, one internal image and one external image. In [`next.config.js`](next.config.js), the `domains` property is used to enable external images. Run or deploy the app to see how it works! The index page ([`pages/index.js`](pages/index.js)) has a couple images, one internal image and one external image. In [`next.config.js`](next.config.js), the `domains` property is used to enable external images. The other pages demonstrate the different layouts. Run or deploy the app to see how it works!
## Deploy your own ## Deploy your own
......
...@@ -11,52 +11,28 @@ const Index = () => ( ...@@ -11,52 +11,28 @@ const Index = () => (
<div className={styles.card}> <div className={styles.card}>
<h1>Image Component with Next.js</h1> <h1>Image Component with Next.js</h1>
<p> <p>
The images below use the{' '} This page demonstrates the usage of the{' '}
<a href="https://nextjs.org/docs/api-reference/next/image"> <a href="https://nextjs.org/docs/api-reference/next/image">
next/image next/image
</a>{' '} </a>{' '}
component to ensure optimal format and size for this browser. component with live examples.
</p> </p>
<p> <p>
Images are also lazy loaded by default which means they don't load until This component is designed to{' '}
scrolled into view. <a href="https://nextjs.org/docs/basic-features/image-optimization">
</p> automatically optimizate
<p>Try scolling down to try it out!</p> </a>{' '}
<hr className={styles.hr} /> images on-demand as the browser requests them.
<p>
The following is an example of a reference to an interal image from the{' '}
<Code>public</Code> directory.
</p>
<p>
Notice that the image is responsive. As you adjust your browser width, a
different sized image is loaded.
</p>
<Image alt="Vercel logo" src="/vercel.png" width={1000} height={1000} />
<hr className={styles.hr} />
<p>
The following is an example of a reference to an external image at{' '}
<Code>assets.vercel.com</Code>.
</p>
<p>
External domains must be configured in <Code>next.config.js</Code> using
the <Code>domains</Code> property.
</p> </p>
<Image
alt="Next.js logo"
src="https://assets.vercel.com/image/upload/v1538361091/repositories/next-js/next-js-bg.png"
width={1200}
height={400}
/>
<hr className={styles.hr} /> <hr className={styles.hr} />
<h2>Layouts</h2> <h2 id="layout">Layout</h2>
<p> <p>
The following pages demonstrate possible <Code>layout</Code> property The <Code>layout</Code> property tells the image to respond differently
values. depending on the device size or the container size.
</p> </p>
<p> <p>
Click on one to try it out with your current device and be sure to Select a layout below and try resizing the window or rotating your
change the window size or rotate your device to see how the image device to see how the image reacts.
reacts.
</p> </p>
<ul> <ul>
<li> <li>
...@@ -86,11 +62,44 @@ const Index = () => ( ...@@ -86,11 +62,44 @@ const Index = () => (
</li> </li>
</ul> </ul>
<hr className={styles.hr} /> <hr className={styles.hr} />
Checkout the documentation for{' '} <h2 id="internal">Internal Image</h2>
<a href="https://nextjs.org/docs/basic-features/image-optimization"> <p>
Image Optimization The following is an example of a reference to an interal image from the{' '}
</a>{' '} <Code>public</Code> directory.
to learn more. </p>
<p>
This image is intentionally large so you have to scroll down to the next
image.
</p>
<Image alt="Vercel logo" src="/vercel.png" width={1000} height={1000} />
<hr className={styles.hr} />
<h2 id="external">External Image</h2>
<p>
The following is an example of a reference to an external image at{' '}
<Code>assets.vercel.com</Code>.
</p>
<p>
External domains must be configured in <Code>next.config.js</Code> using
the <Code>domains</Code> property.
</p>
<Image
alt="Next.js logo"
src="https://assets.vercel.com/image/upload/v1538361091/repositories/next-js/next-js-bg.png"
width={1200}
height={400}
/>
<hr className={styles.hr} />
<h2 id="more">Learn More</h2>
<p>
You can optionally configure a cloud provider, device sizes, and more!
</p>
<p>
Checkout the{' '}
<a href="https://nextjs.org/docs/basic-features/image-optimization">
Image Optimization documentation
</a>{' '}
to learn more.
</p>
</div> </div>
</div> </div>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment