>(null)
- const [attempts, setAttempts] = useState(0)
- const [encodedUrl, setEncodedUrl] = useState('')
- const [isLoaded, setIsLoaded] = useState(false)
-
- useEffect(() => {
- setEncodedUrl(encodeURIComponent(url || ''))
- }, [url])
-
- useEffect(() => {
- const retry = () => {
- if (attempts >= 5 || isLoaded) {
- timer.current && clearInterval(timer.current)
- return
- }
- setAttempts((prev) => prev + 1)
- setEncodedUrl('')
- setEncodedUrl(encodeURIComponent(url || ''))
- }
-
- timer.current && clearInterval(timer.current)
- timer.current = setInterval(retry, 2000)
- return () => {
- timer.current && clearInterval(timer.current)
- }
- }, [attempts, isLoaded, url])
+ const validUrl = url !== '' && !!url
+ const colorTheme = '#FFFFFF80'
+
+ const theme: DocViewerProps['theme'] = {
+ primary: colorTheme,
+ secondary: colorTheme,
+ tertiary: colorTheme,
+ disableThemeScrollbar: true
+ }
+
+ const config: DocViewerProps['config'] = {
+ header: {
+ disableHeader: true
+ },
+ pdfVerticalScrollByDefault: true
+ }
return (
<>
- {encodedUrl && encodedUrl !== '' ? (
+ {validUrl ? (
e.stopPropagation()}
>
@@ -206,14 +192,16 @@ const FileContent = ({
/>
) : (
-