import { Images } from '@/constants/common'; import { api_host } from '@/utils/api'; import { Flex, Image } from 'antd'; import { useParams, useSearchParams } from 'umi'; import Docx from './docx'; import Excel from './excel'; import Pdf from './pdf'; import styles from './index.less'; // TODO: The interface returns an incorrect content-type for the SVG. const DocumentViewer = () => { const { id: documentId } = useParams(); const [currentQueryParameters] = useSearchParams(); const ext = currentQueryParameters.get('ext'); const prefix = currentQueryParameters.get('prefix'); const api = `${api_host}/${prefix || 'file'}/get/${documentId}`; return (
{Images.includes(ext!) && ( )} {ext === 'pdf' && } {(ext === 'xlsx' || ext === 'xls') && } {ext === 'docx' && }
); }; export default DocumentViewer;