e2f16f96c2
This PR updates the docs for the following code change: - #41399 There are a few updates here: - [x] Update docs - [x] Update links to docs inside component - [x] Update examples - [x] Fix corner cases in codemod
46 lines
1 KiB
TypeScript
46 lines
1 KiB
TypeScript
import Image from 'next/image'
|
|
import ViewSource from '../components/view-source'
|
|
import mountains from '../public/mountains.jpg'
|
|
|
|
const Fill = () => (
|
|
<div>
|
|
<ViewSource pathname="pages/layout-fill.tsx" />
|
|
<h1>Image Component With Layout Fill</h1>
|
|
<div style={{ position: 'relative', width: '300px', height: '500px' }}>
|
|
<Image
|
|
alt="Mountains"
|
|
src={mountains}
|
|
fill
|
|
sizes="100vw"
|
|
style={{
|
|
objectFit: 'cover',
|
|
}}
|
|
/>
|
|
</div>
|
|
<div style={{ position: 'relative', width: '300px', height: '500px' }}>
|
|
<Image
|
|
alt="Mountains"
|
|
src={mountains}
|
|
fill
|
|
sizes="100vw"
|
|
style={{
|
|
objectFit: 'contain',
|
|
}}
|
|
/>
|
|
</div>
|
|
<div style={{ position: 'relative', width: '300px', height: '500px' }}>
|
|
<Image
|
|
alt="Mountains"
|
|
src={mountains}
|
|
quality={100}
|
|
fill
|
|
sizes="100vw"
|
|
style={{
|
|
objectFit: 'none',
|
|
}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
|
|
export default Fill
|