diff --git a/packages/pn-commons/src/components/FileUpload.tsx b/packages/pn-commons/src/components/FileUpload.tsx index 301587457d..f8c9febbb6 100644 --- a/packages/pn-commons/src/components/FileUpload.tsx +++ b/packages/pn-commons/src/components/FileUpload.tsx @@ -116,19 +116,11 @@ const reducer = (state: UploadState, action: { type: string; payload?: any }) => } }; -const OrientedBox = ({ - vertical, - justifyContent, - children, -}: { - vertical: boolean; - justifyContent: string; - children: ReactNode; -}) => ( +const OrientedBox = ({ vertical, children }: { vertical: boolean; children: ReactNode }) => ( @@ -136,6 +128,27 @@ const OrientedBox = ({ ); +const FilenameBox = ({ filename }: { filename: string }) => { + const isMobile = useIsMobile(); + console.log(filename); + const [name, extension] = filename.split('.'); + return ( + + + {name}. + + {extension} + + ); +}; + /** * This component allows file upload * @param uploadText text to display @@ -154,7 +167,6 @@ const OrientedBox = ({ const FileUpload = ({ uploadText, vertical = false, - justifyContent = 'center', accept, uploadFn, onFileUploaded, @@ -288,25 +300,6 @@ const FileUpload = ({ ); - const truncateFilename = (filename: string) => { - console.log(filename); - const [name, extension] = filename.split('.'); - return ( - - - {name}. - - {extension} - - ); - }; return ( {fileData.status === UploadStatus.TO_UPLOAD && ( - + {uploadText} {getLocalizedOrDefaultLabel('common', 'upload-file.or', 'oppure')} @@ -344,7 +337,7 @@ const FileUpload = ({ )} {(fileData.status === UploadStatus.IN_PROGRESS || fileData.status === UploadStatus.SENDING) && ( - + {fileData.status === UploadStatus.IN_PROGRESS ? getLocalizedOrDefaultLabel( @@ -375,9 +368,7 @@ const FileUpload = ({ > - - {truncateFilename(fileData.file.name)} - + {parseFileSize(fileData.file.size)}