IZ component for the Fumadocs developer, who use images heavily in their markdown files #840
Replies: 3 comments 10 replies
-
Sounds like a XY problem, you should just ask for “how to use” instead of an alternative component |
Beta Was this translation helpful? Give feedback.
-
Thanks, it is working now. It was not that clear in the docs. Thanks @Skreeauk. |
Beta Was this translation helpful? Give feedback.
-
See I am using that whole thing but there is one issue that did not come insto my vision in the development but when I pushed it for deployment, <MDX
components={{
...defaultMdxComponents,
Steps,
Step,
Tabs,
Tab,
Accordions,
Accordion,
img: (props: { src: string; alt?: string }) => {
console.log("Image props:", props); // Log props for debugging
const { src, alt = "Image description", ...rest } = props;
if (!src) {
console.error("Image source is missing!");
return null;
}
return <ImageZoom src={src} alt={alt} />;
}
}}
/> It shows that it is failing to compile it, it has occured 5 times, I have tried changing all the formats and checking what props are getting passed down, but the issue is still as it is, also it cannot be identified in the development server. Failed to compile.
./app/docs/[[...slug]]/page.tsx:75:30
Type error: Type '{ ref?: LegacyRef<HTMLImageElement> | undefined; key?: Key | null | undefined; alt?: string | undefined; crossOrigin?: CrossOrigin; ... 285 more ...; onTransitionStartCapture?: TransitionEventHandler<...> | undefined; }' is not assignable to type '{ src: string | StaticImport; alt: string; width?: number | `${number}` | undefined; height?: number | `${number}` | undefined; fill?: boolean | undefined; loader?: ImageLoader | undefined; ... 12 more ...; lazyRoot?: string | undefined; }'.
Types of property 'src' are incompatible.
Type 'string | undefined' is not assignable to type 'string | StaticImport'.
Type 'undefined' is not assignable to type 'string | StaticImport'.
73 | Accordions,
74 | Accordion,
> 75 | img: (props) => <ImageZoom {...props} />,
| ^
76 | }}
77 | />
78 | </DocsBody>
Error: Command "npm run build" exited with 1 See, this is the error. And the props are in the following way Image props: {
alt: 'USL11',
placeholder: 'blur',
src: {
src: '/_next/static/media/USL1.11.f2770ecc.png',
width: 1678,
height: 863,
blurDataURL: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAAZElEQVR42jWM2w7CIBQE+f/PJBqpIIZSrtIznpq4yWbmYbNGRPCviL3d8f7Jwzml/7W1hjmr53M4cgqUnCilKistD+QUjKzBmpU9RfYYeAcdHoU5Fte7QXNJ7528bSRrmer/fAGe3XtprhLFFAAAAABJRU5ErkJggg==',
blurWidth: 8,
blurHeight: 4
}
}
What the issue could be ?
Image props: {
alt: 'USL1',
placeholder: 'blur',
src: {
src: '/_next/static/media/USL2.1.c8fdb2ad.png',
width: 1819,
height: 885,
blurDataURL: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAAXklEQVR42jWMSQrEIBBFvf8NG7UXouBEi7ERyeYlJcnbFPUn1XunlII2ho/5orXBWssYA0HlnEkpcRyD/zr5tYZo7b5zTlSMEe/9bqy1tumco9aKrCse5BEjhLCDLxf61Hkts0+nhAAAAABJRU5ErkJggg==',
blurWidth: 8,
blurHeight: 4
}
} |
Beta Was this translation helpful? Give feedback.
-
@fuma-nama, I was using the
, and it did not worked for me when I wanted to use it for too many images as my website constains too many docs, and I have made my short own component for that,
I don't need to tell you what this component does but in short it takes props, just as a small component that people can use in place of this component or the normal
![ImageName](ImagePath)
in mdx.Developer can use this as
It is just that simple to use as I did not understand what the below component did
If you use this you can just provide developer with two option if you
don't want to provide zooming options you can use this
if you want to use next js fast rendering with zomming available for people, you can use this
And for the developers who were using normal images in the past and want to allow zoom, they can find them selves the solution or can use this
If you add this component thanks (no problem if you don't), I will be contributing more things in the future for this amazing docs, if you need any help or want to ask my opinion upon any component ideas or things you can message me.
Happy Coding
Beta Was this translation helpful? Give feedback.
All reactions