forked from kevinanielsen/go-fast-cdn
-
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.
feat: upload multiple files (kevinanielsen#116)
* feat: add property 'multiple' to file input * feat: sends multiple documents or images to api * fix: show icon for each file being uploaded * fix: refresh page after uploading all files * chore: add semicolons * fix: cards overflow * chore: add EOF * fix: prevent file name overflow in card Co-authored-by: Kevin Nielsen <[email protected]> * chore: fix indentation --------- Co-authored-by: Kevin Nielsen <[email protected]>
- Loading branch information
1 parent
5a5640d
commit 4092f85
Showing
5 changed files
with
89 additions
and
51 deletions.
There are no files selected for viewing
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
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,33 @@ | ||
import { FileText } from "lucide-react"; | ||
import { FileImage } from "lucide-react"; | ||
|
||
const UploadPreview = ({fileNames, type}: {fileNames: string[], type: string}) => { | ||
if (fileNames.length >= 7) { | ||
return ( | ||
<ul className="list-columns"> | ||
{fileNames.map(fileName => ( | ||
<li>{fileName}</li> | ||
))} | ||
</ul> | ||
); | ||
} else if (fileNames.length > 0) { | ||
return ( | ||
<section className="flex flex-row overflow-hidden"> | ||
{fileNames.map(fileName => ( | ||
<div className="border rounded-lg w-64 min-h-[264px] max-w-[256px] flex flex-col overflow-hidden justify-center items-center"> | ||
{type == "docs" ? <FileText size="128" /> : <FileImage size="128" />} | ||
<p className="w-full px-2 truncate text-center">{fileName}</p> | ||
</div> | ||
))} | ||
</section> | ||
); | ||
} else { | ||
return ( | ||
<div className="border rounded-lg w-64 min-h-[264px] max-w-[256px] flex justify-center items-center"> | ||
{type == "docs" ? <FileText size="128" /> : <FileImage size="128" />} | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default UploadPreview; |
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