mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 04:45:22 -04:00
fix automatic image blurring
This commit is contained in:
parent
2d6fc82f71
commit
6f31bc53c8
@ -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,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user