Skip to content

Commit

Permalink
Merge pull request Anjaliavv51#104 from weberankit/navigation
Browse files Browse the repository at this point in the history
feat: nav links focus features added used uselocation
  • Loading branch information
gauravsingh1281 authored Oct 27, 2023
2 parents 12a5fbb + d8814d1 commit 5e901be
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Route, Routes } from "react-router-dom";
import { Route, Routes} from "react-router-dom";
import "./App.css";
import { Home, Login, Registration } from "./pages";

const App = () => {

return (
<Routes>
<Route path="/" element={<Home />} />
Expand Down
3 changes: 3 additions & 0 deletions src/components/Header-section/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import '../Header-section/Header-section.css'
import { Link } from "react-router-dom";
import Navbar from './Navbar';
const Header = () => {



return (
<>
<div className="header-section mb-[80px]">
Expand Down
17 changes: 12 additions & 5 deletions src/components/Header-section/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { FiUser } from "react-icons/fi";
import { FiX } from "react-icons/fi";
import { Link } from "react-router-dom";
import { Link ,useLocation } from "react-router-dom";
import logo from "../../assets/Images/logo.png";
import { useState, useEffect } from "react";

const Navbar = () => {
const [showMenu, setShowMenu] = useState("");
const [doBlure, setDoBlure] = useState(false);
const [navLinkbgColor , setNavlinkbgColor] = useState(true)
//find url value
let url =useLocation()
//removing # from nav
url=url.hash.slice(1)



useEffect(() => {
const scrollHandler = () => {
Expand Down Expand Up @@ -136,22 +143,22 @@ const Navbar = () => {
<ul className="flex flex-row lg:gap-10 md:gap-6 font-medium">
<li>
<a href="#home" aria-current="page" className="hover:text-xl hover:shadow-lg transition duration-300">
HOME
{url=="home"?<h1 className="text-green">HOME</h1>:<h1>HOME</h1>}
</a>
</li>
<li>
<a href="#Service" aria-current="page" className="hover:text-xl hover:shadow-md transition duration-300">
RENTALS
{url=="Service"?<h1 className="text-green">RENTALS</h1>:<h1>RENTALS</h1>}
</a>
</li>
<li>
<a href="#AboutUs" aria-current="page" className="hover:text-xl hover:shadow-md transition duration-300">
ABOUT
{url=="AboutUs"?<h1 className="text-green">ABOUT</h1>:<h1>ABOUT</h1>}
</a>
</li>
<li>
<a href="#ContactUs" aria-current="page" className="hover:text-xl hover:shadow-md transition duration-300">
CONTACT
{url=="ContactUs"?<h1 className="text-green">CONTACT</h1>:<h1>CONTACT</h1>}
</a>
</li>
</ul>
Expand Down

0 comments on commit 5e901be

Please sign in to comment.