Download tabler-react/src/components/GalleryCard/GalleryCardImage.react.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 989 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/GalleryCard/GalleryCardImage.react.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/GalleryCard/GalleryCardImage.react.js
-
curl -L -o GalleryCardImage.react.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/GalleryCard/GalleryCardImage.react.js
989 Bytes
| // @flow | |
| import * as React from "react"; | |
| import cn from "classnames"; | |
| type Props = {| | |
| +src: string, | |
| +alt?: string, | |
| +href?: string, | |
| +rounded?: boolean, | |
| +className?: string, | |
| +to?: string, | |
| +RootComponent?: React.ElementType, | |
| |}; | |
| function GalleryCardImage({ | |
| src, | |
| alt, | |
| href, | |
| rounded = true, | |
| className, | |
| to, | |
| RootComponent, | |
| }: Props): React.Node { | |
| const componentClasses = cn("mb-3"); | |
| const imageClasses = cn( | |
| { | |
| rounded: rounded, | |
| }, | |
| className | |
| ); | |
| const componentOptionalProps = {}; | |
| if (href) { | |
| componentOptionalProps.href = href; | |
| } | |
| const image = <img src={src} alt={alt} className={imageClasses} />; | |
| return RootComponent ? ( | |
| <RootComponent className={componentClasses} to={to}> | |
| {image} | |
| </RootComponent> | |
| ) : ( | |
| <a className={componentClasses} {...componentOptionalProps}> | |
| {image} | |
| </a> | |
| ); | |
| } | |
| GalleryCardImage.displayName = "GalleryCard.Image"; | |
| /** @component */ | |
| export default GalleryCardImage; | |