Skip to content

Commit

Permalink
💄 style: improve style of file preview (#3691)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Aug 30, 2024
1 parent 4b8591b commit 7ab4182
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/features/FileViewer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import DocViewer from '@cyntler/react-doc-viewer';
import { createStyles } from 'antd-style';
import { css, cx } from 'antd-style';
import { CSSProperties, memo } from 'react';

import { FileListItem } from '@/types/files';
Expand All @@ -10,27 +10,27 @@ import NotSupport from './NotSupport';
import { FileViewRenderers } from './Renderer';
import PDFRenderer from './Renderer/PDF';

const useStyles = createStyles(({ css, token }) => ({
container: css`
padding: 12px;
background: ${token.colorBgLayout} !important;
`,
}));
const container = css`
background: transparent !important;
#proxy-renderer {
height: 100%;
}
`;

interface FileViewerProps extends FileListItem {
className?: string;
style?: CSSProperties;
}

const FileViewer = memo<FileViewerProps>(({ id, style, fileType, url, name }) => {
const { styles } = useStyles();
if (fileType === 'pdf' || name.endsWith('.pdf')) {
return <PDFRenderer fileId={id} url={url} />;
}

return (
<DocViewer
className={styles.container}
className={cx(container)}
config={{
header: { disableHeader: true },
noRenderer: { overrideComponent: NotSupport },
Expand Down

0 comments on commit 7ab4182

Please sign in to comment.