import React, { useState } from "react"; import { Document, Page, pdfjs } from "react-pdf"; import { Typography } from "@mui/material"; // https://github.com/wojtekmaj/react-pdf?tab=readme-ov-file#copy-worker-to-public-directory pdfjs.GlobalWorkerOptions.workerSrc = process.env.PUBLIC_URL + "/pdf.worker.min.mjs"; interface TermsAndConditionsBoxProps { height: string; onLoad?: () => void; } const TermsAndConditionsBox = ({ height, onLoad, }: TermsAndConditionsBoxProps) => { const [numPages, setNumPages] = useState(); function onDocumentLoadSuccess({ numPages }: { numPages: number }): void { setNumPages(numPages); if (onLoad) { onLoad(); } } return ( <> Terms and Conditions
{Array.apply(null, Array(numPages)) .map((x, i) => i + 1) .map((page) => { return ( ); })}
); }; export default TermsAndConditionsBox;