Download next.js/examples/cms-graphcms/components/cover-image.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-graphcms/components/cover-image.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/cms-graphcms/components/cover-image.js
-
curl -L -o cover-image.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-graphcms/components/cover-image.js
605 Bytes
| import Image from "next/image"; | |
| import Link from "next/link"; | |
| import cn from "classnames"; | |
| export default function CoverImage({ title, url, slug }) { | |
| const image = ( | |
| <Image | |
| width={2000} | |
| height={1000} | |
| alt={`Cover Image for ${title}`} | |
| className={cn("shadow-small", { | |
| "hover:shadow-medium transition-shadow duration-200": slug, | |
| })} | |
| src={url} | |
| /> | |
| ); | |
| return ( | |
| <div className="sm:mx-0"> | |
| {slug ? ( | |
| <Link href={`/posts/${slug}`} aria-label={title}> | |
| {image} | |
| </Link> | |
| ) : ( | |
| image | |
| )} | |
| </div> | |
| ); | |
| } | |