Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675) Reviewed-on: cerc-io/testnet-onboarding-app#15 Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
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'
|
|
|
|
const TermsAndConditionsBox = ({height}: {height: string}) => {
|
|
const [numPages, setNumPages] = useState<number>();
|
|
|
|
function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {
|
|
setNumPages(numPages);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Typography variant='h4' textAlign="center" gutterBottom>
|
|
Terms and Conditions
|
|
</Typography>
|
|
<div
|
|
style={{
|
|
height: height,
|
|
overflowY: 'auto',
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center'
|
|
}}
|
|
>
|
|
<Document
|
|
file={process.env.PUBLIC_URL + '/TermsAndConditions.pdf'}
|
|
onLoadSuccess={onDocumentLoadSuccess}
|
|
>
|
|
{Array.apply(null, Array(numPages))
|
|
.map((x, i) => i + 1)
|
|
.map((page) => {
|
|
return (
|
|
<Page
|
|
key={page}
|
|
pageNumber={page}
|
|
renderTextLayer={false}
|
|
renderAnnotationLayer={false}
|
|
width={1070}
|
|
/>
|
|
);
|
|
})}
|
|
</Document>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TermsAndConditionsBox;
|