Placeholder.tsx 499 B

123456789101112131415161718192021
  1. import React, { useEffect, useState } from 'react';
  2. import PdfSkeleton from '../components/PdfSkeleton';
  3. import useStore from '../store';
  4. import { delay } from '../helpers/time';
  5. const Placeholder: React.FC = () => {
  6. const [{ progress }] = useStore();
  7. const [done, setDone] = useState(false);
  8. useEffect(() => {
  9. delay(1200).then(() => {
  10. setDone(true);
  11. });
  12. }, []);
  13. return progress.loaded < progress.total || !done ? <PdfSkeleton /> : null;
  14. };
  15. export default Placeholder;