import React, { useState } from 'react';
import { Button, Drawer, Space, Spin } from 'antd';
import { DownloadOutlined, CloseOutlined } from '@ant-design/icons';
import { CommonFilePath } from "../../tmpl/interface";
import loadable from '@loadable/component';
import Units from "../../units";
const Loading = ;
const FileViewer = loadable(() => import('react-file-viewer'), { fallback: Loading });
interface DrawerFileViewProps {
filePath: CommonFilePath,
serverKey?: string,
downloadable?: boolean,
};
const Index = (props: DrawerFileViewProps) => {
const { filePath, downloadable } = props;
const [drawerOpen, setDrawerOpen] = useState(false);
const [drawerSize, setDrawerSize] = useState("1200px");
const download = (filePath: CommonFilePath) => {
Units.downloadFile(filePath.path, filePath.fileName);
};
return
{downloadable ? : null}
{drawerOpen ? setDrawerSize(newSize)) }}
closable={false}
onClose={() => setDrawerOpen(false)}
open={drawerOpen}
styles={{ body: { minWidth: "1000px" } }}
extra={
{downloadable ? : null}
}>
console.log(e, 'error in file-viewer')} />
: null
}
;
}
export default Index;