Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Image component lazy loading (#17916)
Co-authored-by: Tim Neutkens <timneutkens@me.com> Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
- Loading branch information
1 parent
b37835a
commit c9eb3dc
Showing
4 changed files
with
236 additions
and
4 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
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,37 @@ | ||
import React from 'react' | ||
import Image from 'next/image' | ||
|
||
const Lazy = () => { | ||
return ( | ||
<div> | ||
<p id="stubtext">This is a page with lazy-loaded images</p> | ||
<Image | ||
id="lazy-top" | ||
src="foo1.jpg" | ||
height="400px" | ||
width="300px" | ||
lazy | ||
></Image> | ||
<div style={{ height: '2000px' }}></div> | ||
<Image | ||
id="lazy-mid" | ||
src="foo2.jpg" | ||
lazy | ||
height="400px" | ||
width="300px" | ||
className="exampleclass" | ||
></Image> | ||
<div style={{ height: '2000px' }}></div> | ||
<Image | ||
id="lazy-bottom" | ||
src="https://www.otherhost.com/foo3.jpg" | ||
height="400px" | ||
width="300px" | ||
unoptimized | ||
lazy | ||
></Image> | ||
</div> | ||
) | ||
} | ||
|
||
export default Lazy |
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