import React, { useState, useEffect, useRef } from "react";
import { MenuBar } from "./menubar";
import "./pdfviewer.scss";
import { Bundle, Loader } from "../../components/";
const PDFJSViewer = (props) => (
{(Comp) => }
);
export function PDFViewer({ filename, data }) {
const [isLoading, setIsLoading] = useState()
return (
{
"application/pdf" in navigator.mimeTypes ? (
) : (
)
}
);
};
function PDFEmbedViewer({ src }) {
const $embed = useRef();
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
if (!$embed.current) return;
const onloadHandler = () => {
setIsLoading(false);
};
$embed.current.addEventListener("load", onloadHandler);
return () => {
$embed.current.removeEventListener("load", onloadHandler);
}
}, [$embed, src]);
return (
{ isLoading && ( ) }
);
}