Skip to content

Commit 3e34fae

Browse files
committed
Updated the footer animation
1 parent 94a9f2b commit 3e34fae

File tree

4 files changed

+63
-57
lines changed

4 files changed

+63
-57
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"dependencies": {
1717
"@docusaurus/core": "^3.5.2",
1818
"@docusaurus/preset-classic": "^3.5.2",
19+
"@lottiefiles/dotlottie-wc": "^0.4.6",
1920
"@mdx-js/react": "^3.0.1",
2021
"@svgr/webpack": "^5.5.0",
2122
"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: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,50 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import styles from "./Footer.module.css";
33
import FooterLayout from "@theme-original/Footer";
4-
import { useLocation } from "@docusaurus/router";
4+
import { useLocation } from "@docusaurus/router";
55

66
const Footer = () => {
77
const location = useLocation();
88
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+
936
return (
10-
<div>
37+
<div className={`footerContainer ${ isHomePage ? styles.footerContainer : ""}`}>
1138
<FooterLayout />
1239
{isHomePage && (
13-
<div className={styles.animatedFooterContainer}>
14-
<div className={styles.footer_bg}>
15-
<div className={styles.footer_bg_one}></div>
16-
<div className={styles.footer_bg_two}></div>
17-
</div>
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>
1848
</div>
1949
)}
2050
</div>

src/theme/Footer.module.css

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,22 @@
1-
2-
html, body {
3-
overflow-x: hidden;
4-
}
5-
6-
.animatedFooterContainer {
7-
position: relative;
8-
margin-top: 0px;
9-
padding-top: 50px;
10-
11-
}
121

13-
html[data-theme="light"] .animatedFooterContainer {
14-
background-color: #f5f6f7;
2+
.lottieContainer {
3+
width: 100vw;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
overflow: hidden !important;
158
}
169

17-
.footer_bg {
18-
width: 100%;
19-
height: 266px;
20-
background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigB8iI5tb8WSVBuVUGc9UjjB8O0708X7Fdic_4O1LT4CmLHoiwhanLXiRhe82yw0R7LgACQ2IhZaTY0hhmGi0gYp_Ynb49CVzfmXtYHUVKgXXpWvJ_oYT8cB4vzsnJLe3iCwuzj-w6PeYq_JaHmy_CoGoa6nw0FBo-2xLdOPvsLTh_fmYH2xhkaZ-OGQ/s16000/footer_bg.png")
21-
no-repeat center;
22-
background-size: cover;
10+
.lottieContainer dotlottie-player {
11+
width: 100vw !important;
12+
height: auto !important;
13+
max-height: 500px !important;
2314
}
2415

25-
.footer_bg_one {
26-
background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia0PYPxwT5ifToyP3SNZeQWfJEWrUENYA5IXM6sN5vLwAKvaJS1pQVu8mOFFUa_ET4JuHNTFAxKURFerJYHDUWXLXl1vDofYXuij45JZelYOjEFoCOn7E6Vxu0fwV7ACPzArcno1rYuVxGB7JY6G7__e4_KZW4lTYIaHSLVaVLzklZBLZnQw047oq5-Q/s16000/volks.gif")
27-
no-repeat center;
28-
background-size: contain;
29-
width: 330px;
30-
height: 105px;
31-
position: absolute;
32-
bottom: 0;
33-
animation: carMove 22s linear infinite;
16+
.footerContainer {
17+
--ifm-footer-background-color: #61AE9D;
3418
}
3519

36-
.footer_bg_two {
37-
background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyLGwEUVwPK6Vi8xXMymsc-ZXVwLWyXhogZxbcXQYSY55REw_0D4VTQnsVzCrL7nsyjd0P7RVOI5NKJbQ75koZIalD8mqbMquP20fL3DxsWngKkOLOzoOf9sMuxlbyfkIBTsDw5WFUj-YJiI50yzgVjF8cZPHhEjkOP_PRTQXDHEq8AyWpBiJdN9SfQA/s16000/cyclist.gif")
38-
no-repeat center;
39-
background-size: contain;
40-
width: 88px;
41-
height: 100px;
42-
position: absolute;
43-
bottom: 0;
44-
animation: cyclistMove 30s linear infinite;
20+
.footerContainer .footer {
21+
--ifm-footer-background-color: #61AE9D;
4522
}
46-
47-
48-
@keyframes carMove {
49-
0% { left: -25%; }
50-
100% { left: 100%; }
51-
}
52-
53-
@keyframes cyclistMove {
54-
0% { left: -25%; }
55-
100% { left: 100%; }
56-
}
57-

0 commit comments

Comments
 (0)