Skip to content

Commit 70345ad

Browse files
committed
Trying to improve performances
1 parent 8d951d3 commit 70345ad

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/components/molecules/FlyingInsects/index.module.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
color: var(--nt-orange);
2525
}
2626

27-
@media (hover: none) and (pointer: coarse) {
28-
display: none;
29-
}
27+
// @media (hover: none) and (pointer: coarse) {
28+
// display: none;
29+
// }
3030

3131
@media (display-mode: fullscreen) {
3232
transform: translateY(-80px);

src/components/molecules/FlyingInsects/index.tsx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { Suspense, lazy, useEffect, useState } from 'react';
22
import FlyingInsect from '../../atoms/FlyingInsect';
33
import * as styles from './index.module.scss';
4-
import Flocking from '../../atoms/Flocking';
4+
// import Flocking from '../../atoms/Flocking';
55
import detectBrowser from '../../../utilities/detectBrowser';
66

7-
const isBrowser = typeof window !== 'undefined';
7+
// const isBrowser = typeof window !== 'undefined';
88

99
const Index = () => {
10+
const Flocking = lazy(() => import('../../atoms/Flocking'));
11+
// const [animate, setAnimate] = useState<boolean>(false);
1012
// const [catched, setCatched] = useState<number>(0);
1113
// const handleClick = () => setCatched((old) => old + 1);
1214

@@ -35,28 +37,27 @@ const Index = () => {
3537
// }
3638
// }
3739

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+
// };
4547

4648
return (
4749
<div className={styles.wrap}>
4850
{/* <FlyingInsect top={30} onClick={handleClick} />
4951
<FlyingInsect top={50} onClick={handleClick} />
5052
<FlyingInsect top={70} onClick={handleClick} />
5153
<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>
6061
</div>
6162
);
6263
};

0 commit comments

Comments
 (0)