Skip to content

Commit

Permalink
Trying to improve performances
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeCheek committed May 21, 2024
1 parent 8d951d3 commit 70345ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/components/molecules/FlyingInsects/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
color: var(--nt-orange);
}

@media (hover: none) and (pointer: coarse) {
display: none;
}
// @media (hover: none) and (pointer: coarse) {
// display: none;
// }

@media (display-mode: fullscreen) {
transform: translateY(-80px);
Expand Down
37 changes: 19 additions & 18 deletions src/components/molecules/FlyingInsects/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React, { useEffect, useState } from 'react';
import React, { Suspense, lazy, useEffect, useState } from 'react';
import FlyingInsect from '../../atoms/FlyingInsect';
import * as styles from './index.module.scss';
import Flocking from '../../atoms/Flocking';
// import Flocking from '../../atoms/Flocking';
import detectBrowser from '../../../utilities/detectBrowser';

const isBrowser = typeof window !== 'undefined';
// const isBrowser = typeof window !== 'undefined';

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

Expand Down Expand Up @@ -35,28 +37,27 @@ const Index = () => {
// }
// }

const toggleFullscreen = () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else {
document.exitFullscreen();
}
};
// const toggleFullscreen = () => {
// if (!document.fullscreenElement) {
// document.documentElement.requestFullscreen();
// } else {
// document.exitFullscreen();
// }
// };

return (
<div className={styles.wrap}>
{/* <FlyingInsect top={30} onClick={handleClick} />
<FlyingInsect top={50} onClick={handleClick} />
<FlyingInsect top={70} onClick={handleClick} />
<FlyingInsect top={20} onClick={handleClick} /> */}
{isBrowser && detectBrowser() != 'Safari' ? (
<button className={styles.zen} onClick={toggleFullscreen}>
Zen Mode
</button>
) : (
<></>
)}
<Flocking />
{/* <button className={styles.zen} onClick={() => setAnimate((a) => !a)}>
Animate Background
</button> */}
{/* {animate ? <Flocking /> : <></>} */}
<Suspense>
<Flocking />
</Suspense>
</div>
);
};
Expand Down

0 comments on commit 70345ad

Please sign in to comment.