diff --git a/src/App.js b/src/App.js index 3784575..7fcaa55 100644 --- a/src/App.js +++ b/src/App.js @@ -1,23 +1,11 @@ -import logo from './logo.svg'; import './App.css'; +import NavBar from './components/Navbar'; +import 'bootstrap/dist/css/bootstrap.min.css'; function App() { return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
+
+
); } diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 0c9a075..c745341 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -1,27 +1,52 @@ import Container from 'react-bootstrap/Container'; import Nav from 'react-bootstrap/Nav'; import Navbar from 'react-bootstrap/Navbar'; -import { useState } from "react"; +import { useState, useEffect} from "react"; +import logo from '../assets/img/logo.svg'; +import navIcon1 from '../assets/img/nav-icon1.svg'; +import navIcon3 from '../assets/img/nav-icon2.svg'; +import navIcon2 from '../assets/img/nav-icon3.svg'; + const NavBar = () => { + const [activeLink, setActiveLink] = useState('home'); + const [scrolled, setScrolled] = useState(false); +//check for scrolling + useEffect(() => { + const onScroll = () => { + if (window.scrollY > 50) { + setScrolled(true); + } else { + setScrolled(false); + } + } + + window.addEventListener("scroll", onScroll); + // remove event listener when components unmounts + return () => window.removeEventListener("scroll", onScroll); + }, []) + + const onUpdateLink = (value) => { + setActiveLink(value) + } return ( - + - logo + logo
- - - + nav-icon1 + nav-icon2 + nav-icon3