-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
101 additions
and
42 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
client/src/containers/profile/file-upload/description/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { FC } from "react"; | ||
|
||
import { FileDownIcon } from "lucide-react"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
|
||
const downloadFiles = (files: iFile[]) => { | ||
files.forEach((f) => { | ||
const link = document.createElement("a"); | ||
link.href = f.path; | ||
link.download = f.path.split("/").pop() || ""; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
}); | ||
}; | ||
|
||
const openFileUploadWindow = () => | ||
document.getElementById("share-information-input")?.click(); | ||
|
||
interface iFile { | ||
name: string; | ||
path: string; | ||
} | ||
|
||
interface FileUploadDescriptionProps { | ||
files: iFile[]; | ||
} | ||
|
||
const FileUploadDescription: FC<FileUploadDescriptionProps> = ({ files }) => { | ||
return ( | ||
<> | ||
<p> | ||
Provide your input on the methodology and data by | ||
<Button | ||
variant="link" | ||
className="p-0 text-primary" | ||
onClick={() => downloadFiles(files)} | ||
> | ||
downloading | ||
</Button> | ||
the required templates, completing them with the necessary | ||
information, and | ||
<Button | ||
variant="link" | ||
className="p-0 text-primary" | ||
onClick={openFileUploadWindow} | ||
> | ||
uploading | ||
</Button> | ||
them to contribute new insights for evaluation. | ||
</p> | ||
|
||
<ol className="flex gap-4"> | ||
{files.map((f) => ( | ||
<li key={`file-${f.name}`}> | ||
<Button variant="link" className="p-0" asChild> | ||
<a href={f.path}> | ||
<FileDownIcon className="h-5 w-5" strokeWidth={1} /> | ||
<span>{f.name}</span> | ||
</a> | ||
</Button> | ||
</li> | ||
))} | ||
</ol> | ||
</> | ||
); | ||
}; | ||
|
||
export default FileUploadDescription; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters