show download buttons when file content is still loading

This commit is contained in:
spencerwooo
2022-02-22 14:09:57 +08:00
parent bd5dbfef4f
commit 9e50a024ee
3 changed files with 28 additions and 11 deletions
+10 -5
View File
@@ -29,14 +29,19 @@ const CodePreview: FC<{ file: any }> = ({ file }) => {
}
if (validating) {
return (
<PreviewContainer>
<Loading loadingText={t('Loading file content...')} />
</PreviewContainer>
<>
<PreviewContainer>
<Loading loadingText={t('Loading file content...')} />
</PreviewContainer>
<DownloadBtnContainer>
<DownloadButtonGroup />
</DownloadBtnContainer>
</>
)
}
return (
<div>
<>
<PreviewContainer>
<SyntaxHighlighter
language={getLanguageByFileName(file.name)}
@@ -48,7 +53,7 @@ const CodePreview: FC<{ file: any }> = ({ file }) => {
<DownloadBtnContainer>
<DownloadButtonGroup />
</DownloadBtnContainer>
</div>
</>
)
}
+10 -3
View File
@@ -96,9 +96,16 @@ const MarkdownPreview: FC<{
}
if (validating) {
return (
<PreviewContainer>
<Loading loadingText={t('Loading file content...')} />
</PreviewContainer>
<>
<PreviewContainer>
<Loading loadingText={t('Loading file content...')} />
</PreviewContainer>
{standalone && (
<DownloadBtnContainer>
<DownloadButtonGroup />
</DownloadBtnContainer>
)}
</>
)
}
+8 -3
View File
@@ -30,9 +30,14 @@ const TextPreview = ({ file }) => {
if (!content) {
return (
<PreviewContainer>
<FourOhFour errorMsg={t('File is empty.')} />
</PreviewContainer>
<>
<PreviewContainer>
<FourOhFour errorMsg={t('File is empty.')} />
</PreviewContainer>
<DownloadBtnContainer>
<DownloadButtonGroup />
</DownloadBtnContainer>
</>
)
}