forked from PecanProject/PecanProject.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFooter.js
More file actions
54 lines (45 loc) · 1.44 KB
/
Footer.js
File metadata and controls
54 lines (45 loc) · 1.44 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React, { useEffect } from "react";
import styles from "./Footer.module.css";
import FooterLayout from "@theme-original/Footer";
import { useLocation } from "@docusaurus/router";
const Footer = () => {
const location = useLocation();
const isHomePage = location.pathname === "/";
useEffect(() => {
import("@dotlottie/player-component");
}, []);
useEffect(() => {
const navbar = document.querySelector(".navbar");
const footer = document.querySelector(".footerContainer");
if (!navbar || !footer || !isHomePage) return;
const observer = new IntersectionObserver(
(entries) => {
if (entries[0].isIntersecting) {
navbar.style.backgroundColor = "#61AE9D";
} else {
navbar.style.backgroundColor = "";
}
},
{ threshold: 1 }
);
observer.observe(footer);
return () => observer.disconnect();
}, []);
return (
<div className={`footerContainer ${ isHomePage ? styles.footerContainer : ""}`}>
<FooterLayout />
{isHomePage && (
<div className={styles.lottieContainer}>
<dotlottie-player
src="https://lottie.host/f466ad48-fde8-452a-aca8-2d153e8969ff/l92UT8AOsP.lottie"
background="transparent"
speed="1"
loop
autoplay
></dotlottie-player>
</div>
)}
</div>
);
};
export default Footer;