web: don't start loading pig pattern until user starts to approach it

This commit is contained in:
2026-05-19 22:50:33 +02:00
parent 6d712d31be
commit cb9b108526
3 changed files with 33 additions and 12 deletions
+22
View File
@@ -0,0 +1,22 @@
"use client";
import { useInView } from "react-intersection-observer";
import styles from "./footer.module.scss";
import { ToTop } from "./ToTop";
export const PigPattern = () => {
const { ref, inView } = useInView({
triggerOnce: true,
rootMargin: "1000px",
});
return (
<div
ref={ref}
className={`${styles.pigPattern} ${inView ? styles.loaded : ""}`}
>
<div className={styles.toTop}>
<ToTop />
</div>
</div>
);
};