summaryrefslogtreecommitdiff
path: root/src-migrate/modules/popup-information/index.tsx
blob: 0d48a92a91b167b8c6b9f1a572fe3f3ecd4f4b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import Modal from '~/common/components/elements/Modal';
import { getAuth } from '~/common/libs/auth';
import PageContent from '../page-content';
import Link from 'next/link';

const PagePopupInformation = () => {
  const router = useRouter();
  const isHomePage = router.pathname === '/';
  const auth = getAuth();
  const [active, setActive] = useState<boolean>(false);

  useEffect(() => {
    if (isHomePage && !auth) {
      setActive(true);
    }
  }, [isHomePage, auth]);
  return (
    <div className='group'>
      <Modal
        active={active}
        className='w-10/12 md:w-fit'
        close={() => setActive(false)}
        mode='desktop'
      >
        <div>
          <PageContent path='/onbording-popup' />
          <Link href={'/register'} className='btn-yellow w-full mt-2'>
            Daftar Sekarang
          </Link>
        </div>
      </Modal>
    </div>
  );
};

export default PagePopupInformation;