From 7565f169db5b81999c9d655bf9bf8ccd92fabf96 Mon Sep 17 00:00:00 2001
From: siddiquiadab <80346223+adab786@users.noreply.github.com>
Date: Thu, 29 Aug 2024 02:23:55 +0530
Subject: [PATCH 1/2] Update NavBar.js
---
personal-portfolio/src/components/NavBar.js | 95 +++++++++++----------
1 file changed, 51 insertions(+), 44 deletions(-)
diff --git a/personal-portfolio/src/components/NavBar.js b/personal-portfolio/src/components/NavBar.js
index cce00e7d5..a24a913f7 100644
--- a/personal-portfolio/src/components/NavBar.js
+++ b/personal-portfolio/src/components/NavBar.js
@@ -5,62 +5,69 @@ import navIcon1 from '../assets/img/nav-icon1.svg';
import navIcon2 from '../assets/img/nav-icon2.svg';
import navIcon3 from '../assets/img/nav-icon3.svg';
import { HashLink } from 'react-router-hash-link';
-import {
- BrowserRouter as Router
-} from "react-router-dom";
export const NavBar = () => {
-
const [activeLink, setActiveLink] = useState('home');
const [scrolled, setScrolled] = useState(false);
useEffect(() => {
const onScroll = () => {
- if (window.scrollY > 50) {
- setScrolled(true);
- } else {
- setScrolled(false);
- }
- }
+ setScrolled(window.scrollY > 50);
+ };
window.addEventListener("scroll", onScroll);
-
return () => window.removeEventListener("scroll", onScroll);
- }, [])
+ }, []);
const onUpdateActiveLink = (value) => {
setActiveLink(value);
- }
+ };
return (
-