MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / MDXImage

Function MDXImage

apps/site/components/MDX/Image/index.tsx:6–25  ·  view source on GitHub ↗
({ width, height, alt, src, ...props })

Source from the content-addressed store, hash-verified

4import type { FC } from 'react';
5
6const MDXImage: FC<ImageProps> = ({ width, height, alt, src, ...props }) => {
7 if (!width || !height) {
8 // Since `width` and `height` are not provided in the Markdown image format,
9 // we provide the height and width automatically.
10 // @see https://nextjs.org/docs/pages/building-your-application/optimizing/images
11 return (
12 <Image
13 {...props}
14 src={src}
15 alt={alt}
16 width={0}
17 height={0}
18 sizes="(min-width: 768px) 200vw, 500vw"
19 className="h-auto w-auto"
20 />
21 );
22 }
23
24 return <Image {...props} alt={alt} width={width} height={height} src={src} />;
25};
26
27export default MDXImage;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected