|
1 |
| -import React, { useEffect, useState } from 'react'; |
| 1 | +import React, { Suspense, lazy, useEffect, useState } from 'react'; |
2 | 2 | import FlyingInsect from '../../atoms/FlyingInsect';
|
3 | 3 | import * as styles from './index.module.scss';
|
4 |
| -import Flocking from '../../atoms/Flocking'; |
| 4 | +// import Flocking from '../../atoms/Flocking'; |
5 | 5 | import detectBrowser from '../../../utilities/detectBrowser';
|
6 | 6 |
|
7 |
| -const isBrowser = typeof window !== 'undefined'; |
| 7 | +// const isBrowser = typeof window !== 'undefined'; |
8 | 8 |
|
9 | 9 | const Index = () => {
|
| 10 | + const Flocking = lazy(() => import('../../atoms/Flocking')); |
| 11 | + // const [animate, setAnimate] = useState<boolean>(false); |
10 | 12 | // const [catched, setCatched] = useState<number>(0);
|
11 | 13 | // const handleClick = () => setCatched((old) => old + 1);
|
12 | 14 |
|
@@ -35,28 +37,27 @@ const Index = () => {
|
35 | 37 | // }
|
36 | 38 | // }
|
37 | 39 |
|
38 |
| - const toggleFullscreen = () => { |
39 |
| - if (!document.fullscreenElement) { |
40 |
| - document.documentElement.requestFullscreen(); |
41 |
| - } else { |
42 |
| - document.exitFullscreen(); |
43 |
| - } |
44 |
| - }; |
| 40 | + // const toggleFullscreen = () => { |
| 41 | + // if (!document.fullscreenElement) { |
| 42 | + // document.documentElement.requestFullscreen(); |
| 43 | + // } else { |
| 44 | + // document.exitFullscreen(); |
| 45 | + // } |
| 46 | + // }; |
45 | 47 |
|
46 | 48 | return (
|
47 | 49 | <div className={styles.wrap}>
|
48 | 50 | {/* <FlyingInsect top={30} onClick={handleClick} />
|
49 | 51 | <FlyingInsect top={50} onClick={handleClick} />
|
50 | 52 | <FlyingInsect top={70} onClick={handleClick} />
|
51 | 53 | <FlyingInsect top={20} onClick={handleClick} /> */}
|
52 |
| - {isBrowser && detectBrowser() != 'Safari' ? ( |
53 |
| - <button className={styles.zen} onClick={toggleFullscreen}> |
54 |
| - Zen Mode |
55 |
| - </button> |
56 |
| - ) : ( |
57 |
| - <></> |
58 |
| - )} |
59 |
| - <Flocking /> |
| 54 | + {/* <button className={styles.zen} onClick={() => setAnimate((a) => !a)}> |
| 55 | + Animate Background |
| 56 | + </button> */} |
| 57 | + {/* {animate ? <Flocking /> : <></>} */} |
| 58 | + <Suspense> |
| 59 | + <Flocking /> |
| 60 | + </Suspense> |
60 | 61 | </div>
|
61 | 62 | );
|
62 | 63 | };
|
|
0 commit comments