Spaces:
Configuration error
Configuration error
Download src/components/ImagePreview.jsx from webml-community/Janus-1.3B-WebGPU: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/spaces/webml-community/Janus-1.3B-WebGPU/resolve/refs%2Fpr%2F2/src/components/ImagePreview.jsx
- Command line
-
hf download hf://spaces/webml-community/Janus-1.3B-WebGPU@refs/pr/2/src/components/ImagePreview.jsx
-
curl -L -o ImagePreview.jsx https://huggingface.co/spaces/webml-community/Janus-1.3B-WebGPU/resolve/refs%2Fpr%2F2/src/components/ImagePreview.jsx
667 Bytes
| import { useState } from "react"; | |
| import CrossIcon from "./icons/CrossIcon"; | |
| export default function ImagePreview({ src, onRemove, ...props }) { | |
| const [hover, setHover] = useState(false); | |
| return ( | |
| <div | |
| {...props} | |
| onMouseEnter={() => setHover(true)} | |
| onMouseLeave={() => setHover(false)} | |
| > | |
| <CrossIcon | |
| onClick={onRemove} | |
| className={`absolute top-0 right-0 cursor-pointer dark:fill-gray-400 dark:text-gray-100 fill-gray-200 text-gray-800 ${hover ? "" : "hidden"}`} | |
| /> | |
| <img | |
| src={src} | |
| alt="Upload preview" | |
| className="w-full h-full object-cover rounded-md" | |
| /> | |
| </div> | |
| ); | |
| } | |