diff --git a/suchith-m/src/App.jsx b/suchith-m/src/App.jsx index 9d42427..9908d51 100644 --- a/suchith-m/src/App.jsx +++ b/suchith-m/src/App.jsx @@ -6,6 +6,7 @@ import Footer from "./components/Footer"; import Home from "./components/Home"; import Sidebar from "./components/Sidebar"; import Skills from "./components/Skills"; +import FadeInSection from "./components/FadeInSection"; function App() { return ( @@ -33,18 +34,26 @@ function App() { -
- -
-
- -
-
- -
-
- -
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
diff --git a/suchith-m/src/components/FadeInSection.jsx b/suchith-m/src/components/FadeInSection.jsx new file mode 100644 index 0000000..68e9767 --- /dev/null +++ b/suchith-m/src/components/FadeInSection.jsx @@ -0,0 +1,23 @@ +import { useEffect, useRef, useState } from "react"; + +function FadeInSection(props) { + const [isVisible, setVisible] = useState(true); + const domRef = useRef(); + useEffect(() => { + const observer = new IntersectionObserver((entries) => { + entries.forEach((entry) => setVisible(entry.isIntersecting)); + }); + observer.observe(domRef.current); + return () => observer.unobserve(domRef.current); + }, []); + return ( +
+ {props.children} +
+ ); +} + +export default FadeInSection;