Skip to content

Commit

Permalink
use pointerEvents='none' to remove default pointer style added by bro…
Browse files Browse the repository at this point in the history
…wser
  • Loading branch information
eh2077 committed Mar 1, 2024
1 parent ecc5960 commit 43b70c1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,6 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
// We don't support scaning password protected PDF receipt
enabled={!isAttachmentInvalid}
onPassword={() => setIsAttachmentInvalid(true)}
isClickable={false}
/>
) : (
<Image
Expand Down
4 changes: 0 additions & 4 deletions src/components/PDFThumbnail/index.css

This file was deleted.

12 changes: 5 additions & 7 deletions src/components/PDFThumbnail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {Document, pdfjs, Thumbnail} from 'react-pdf';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import useThemeStyles from '@hooks/useThemeStyles';
import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import './index.css';
import type PDFThumbnailProps from './types';

function PDFThumbnail({previewSourceURL, style, isAuthTokenRequired = false, enabled = true, onPassword = () => {}, isClickable = true}: PDFThumbnailProps) {
function PDFThumbnail({previewSourceURL, style, isAuthTokenRequired = false, enabled = true, onPassword = () => {}}: PDFThumbnailProps) {
const styles = useThemeStyles();

useEffect(() => {
Expand All @@ -33,13 +32,12 @@ function PDFThumbnail({previewSourceURL, style, isAuthTokenRequired = false, ena
onPassword();
}}
>
<Thumbnail
pageIndex={0}
className={isClickable ? '' : 'react-pdf__Thumbnail--notClickable'}
/>
<View pointerEvents="none">
<Thumbnail pageIndex={0} />
</View>
</Document>
),
[isAuthTokenRequired, previewSourceURL, onPassword, isClickable],
[isAuthTokenRequired, previewSourceURL, onPassword],
);

return (
Expand Down
3 changes: 0 additions & 3 deletions src/components/PDFThumbnail/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ type PDFThumbnailProps = {

/** Callback to call if PDF is password protected */
onPassword?: () => void;

/** Whether the PDF thumbnail is clickable */
isClickable?: boolean;
};

export default PDFThumbnailProps;

0 comments on commit 43b70c1

Please sign in to comment.