Skip to content

Commit e4c00c0

Browse files
authored
Merge pull request #88 from divine7022/enhance-footer
Added an Animation to the footer to enhance UI.
2 parents 3ffddd4 + 0c67e20 commit e4c00c0

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"dependencies": {
1717
"@docusaurus/core": "^3.5.2",
1818
"@docusaurus/preset-classic": "^3.5.2",
19+
"@dotlottie/player-component": "^2.7.12",
20+
"@lottiefiles/dotlottie-wc": "^0.4.6",
1921
"@mdx-js/react": "^3.0.1",
2022
"@svgr/webpack": "^8.1.0",
2123
"clsx": "^1.1.1",

src/css/custom.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ html[data-theme="dark"] {
3131
border-radius: 15px !important;
3232
}
3333

34+
html, body {
35+
overflow-x: hidden;
36+
}
37+
38+
html, body {
39+
overflow-y: scroll;
40+
scrollbar-width: none;
41+
}
42+
3443
/* Footer */
3544

3645
html[data-theme="dark"] .footer {
@@ -221,3 +230,4 @@ html[data-theme="light"] .footer-logo-text {
221230
color: rgb(70, 203, 174);
222231
text-decoration: none !important;
223232
}
233+

src/theme/Footer.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React, { useEffect } from "react";
2+
import styles from "./Footer.module.css";
3+
import FooterLayout from "@theme-original/Footer";
4+
import { useLocation } from "@docusaurus/router";
5+
6+
const Footer = () => {
7+
const location = useLocation();
8+
const isHomePage = location.pathname === "/";
9+
10+
useEffect(() => {
11+
import("@dotlottie/player-component");
12+
}, []);
13+
14+
useEffect(() => {
15+
const navbar = document.querySelector(".navbar");
16+
const footer = document.querySelector(".footerContainer");
17+
18+
if (!navbar || !footer || !isHomePage) return;
19+
20+
const observer = new IntersectionObserver(
21+
(entries) => {
22+
if (entries[0].isIntersecting) {
23+
navbar.style.backgroundColor = "#61AE9D";
24+
} else {
25+
navbar.style.backgroundColor = "";
26+
}
27+
},
28+
{ threshold: 1 }
29+
);
30+
31+
observer.observe(footer);
32+
33+
return () => observer.disconnect();
34+
}, []);
35+
36+
return (
37+
<div className={`footerContainer ${ isHomePage ? styles.footerContainer : ""}`}>
38+
<FooterLayout />
39+
{isHomePage && (
40+
<div className={styles.lottieContainer}>
41+
<dotlottie-player
42+
src="https://lottie.host/f466ad48-fde8-452a-aca8-2d153e8969ff/l92UT8AOsP.lottie"
43+
background="transparent"
44+
speed="1"
45+
loop
46+
autoplay
47+
></dotlottie-player>
48+
</div>
49+
)}
50+
</div>
51+
);
52+
};
53+
54+
export default Footer;

src/theme/Footer.module.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
.lottieContainer {
3+
width: 100vw;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
overflow: hidden !important;
8+
}
9+
10+
.lottieContainer dotlottie-player {
11+
width: 100vw !important;
12+
height: auto !important;
13+
max-height: 500px !important;
14+
}
15+
16+
.footerContainer {
17+
--ifm-footer-background-color: #61AE9D;
18+
}
19+
20+
.footerContainer .footer {
21+
--ifm-footer-background-color: #61AE9D;
22+
}

0 commit comments

Comments
 (0)