1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 07:56:40 -04:00

fix automatic image blurring

This commit is contained in:
2025-03-08 13:51:26 -05:00
parent 2d6fc82f71
commit 6f31bc53c8

View File

@ -11,18 +11,19 @@ export type ImageProps = ComponentPropsWithoutRef<typeof NextImage> & {
inline?: boolean; // don't wrap everything in a `<div>` block
};
const Image = ({ src, height, width, quality, inline, className, ...rest }: ImageProps) => {
const Image = ({ src, height, width, quality, placeholder, inline, className, ...rest }: ImageProps) => {
const constrainWidth = (width?: number | `${number}`) => {
if (!width) return MAX_WIDTH;
return Math.min(typeof width === "string" ? parseInt(width, 10) : width, MAX_WIDTH);
};
const imageProps = {
const imageProps: ImageProps = {
src,
height,
width: constrainWidth(width || (src as StaticImageData).width),
quality: quality || 75,
placeholder: placeholder || (typeof src === "string" ? "empty" : "blur"),
...rest,
};