Download src/components/features/chat/uploaded-file.tsx from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/components/features/chat/uploaded-file.tsx
- Command line
-
hf download hf://SaylorTwift/openhands/src/components/features/chat/uploaded-file.tsx
-
curl -L -o uploaded-file.tsx https://huggingface.co/SaylorTwift/openhands/resolve/main/src/components/features/chat/uploaded-file.tsx
1.5 kB
| import { LoaderCircle } from "lucide-react"; | |
| import FileIcon from "#/icons/file.svg?react"; | |
| import { RemoveFileButton } from "./remove-file-button"; | |
| import { cn, getFileExtension } from "#/utils/utils"; | |
| interface UploadedFileProps { | |
| file: File; | |
| onRemove: () => void; | |
| isLoading?: boolean; | |
| } | |
| export function UploadedFile({ | |
| file, | |
| onRemove, | |
| isLoading = false, | |
| }: UploadedFileProps) { | |
| const fileExtension = getFileExtension(file.name); | |
| return ( | |
| <div className="group flex gap-2 rounded-lg bg-[var(--oh-interactive-hover)] max-w-[160px] px-3 py-1 relative"> | |
| <div className="flex flex-col justify-center gap-0.25"> | |
| <RemoveFileButton onClick={onRemove} /> | |
| <div className="flex items-center gap-2 w-full"> | |
| <span | |
| className={cn( | |
| "text-sm font-normal leading-5 flex-1 max-w-[136px] truncate", | |
| isLoading ? "max-w-[108px] text-[var(--oh-muted)]" : "text-white", | |
| )} | |
| > | |
| {file.name} | |
| </span> | |
| </div> | |
| <div className="flex items-center gap-2"> | |
| <FileIcon width={12} height={12} color="var(--oh-muted)" /> | |
| <span className="text-[9px] font-normal leading-5 text-[var(--oh-muted)]"> | |
| {fileExtension} | |
| </span> | |
| </div> | |
| </div> | |
| {isLoading && ( | |
| <div className="flex items-center justify-center"> | |
| <LoaderCircle className="animate-spin w-5 h-5" color="white" /> | |
| </div> | |
| )} | |
| </div> | |
| ); | |
| } | |