Make next/images responsive
This commit is contained in:
parent
6e94f9f23a
commit
42b0ead70a
@ -28,7 +28,7 @@ const createRemotePattern = (hostname) => hostname
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
images: {
|
images: {
|
||||||
imageSizes: [200, 1080],
|
imageSizes: [200],
|
||||||
remotePatterns: []
|
remotePatterns: []
|
||||||
.concat(createRemotePattern(HOSTNAME_VERCEL_BLOB))
|
.concat(createRemotePattern(HOSTNAME_VERCEL_BLOB))
|
||||||
.concat(createRemotePattern(HOSTNAME_CLOUDFLARE_R2))
|
.concat(createRemotePattern(HOSTNAME_CLOUDFLARE_R2))
|
||||||
|
|||||||
@ -66,7 +66,7 @@ export default function ImageBlurFallback(props: ImageProps) {
|
|||||||
className: clsx(
|
className: clsx(
|
||||||
imageClassName,
|
imageClassName,
|
||||||
// Fix poorly blurred placeholder data generated by Safari
|
// Fix poorly blurred placeholder data generated by Safari
|
||||||
'blur-md scale-110',
|
'blur-md scale-105',
|
||||||
),
|
),
|
||||||
}} />
|
}} />
|
||||||
: <div className={clsx(
|
: <div className={clsx(
|
||||||
@ -78,6 +78,7 @@ export default function ImageBlurFallback(props: ImageProps) {
|
|||||||
...rest,
|
...rest,
|
||||||
ref: imgRef,
|
ref: imgRef,
|
||||||
priority,
|
priority,
|
||||||
|
layout: 'responsive',
|
||||||
className: imageClassName,
|
className: imageClassName,
|
||||||
onLoad: () => setIsLoading(false),
|
onLoad: () => setIsLoading(false),
|
||||||
onError: () => setDidError(true),
|
onError: () => setDidError(true),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { BASE_URL } from '@/site/config';
|
import { BASE_URL } from '@/site/config';
|
||||||
|
|
||||||
// Explicity defined next.config.js `imageSizes`
|
// Explicity defined next.config.js `imageSizes`
|
||||||
type NextCustomSize = 200 | 1080;
|
type NextCustomSize = 200;
|
||||||
|
|
||||||
type NextImageDeviceSize = 640 | 750 | 828 | 1080 | 1200 | 1920 | 2048 | 3840;
|
type NextImageDeviceSize = 640 | 750 | 828 | 1080 | 1200 | 1920 | 2048 | 3840;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user