Download next.js/examples/cms-contentful/lib/contentful-image.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 476 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-contentful/lib/contentful-image.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/cms-contentful/lib/contentful-image.tsx
-
curl -L -o contentful-image.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-contentful/lib/contentful-image.tsx
476 Bytes
| "use client"; | |
| import Image from "next/image"; | |
| interface ContentfulImageProps { | |
| src: string; | |
| width?: number; | |
| quality?: number; | |
| [key: string]: any; // For other props that might be passed | |
| } | |
| const contentfulLoader = ({ src, width, quality }: ContentfulImageProps) => { | |
| return `${src}?w=${width}&q=${quality || 75}`; | |
| }; | |
| export default function ContentfulImage(props: ContentfulImageProps) { | |
| return <Image alt={props.alt} loader={contentfulLoader} {...props} />; | |
| } | |