-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from mayank-0789/hamburger
Hamburger issue resolved
- Loading branch information
Showing
2 changed files
with
66 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { useEffect, useState } from "react"; | ||
import { useState, useEffect } from "react"; | ||
|
||
function Navbar() { | ||
const [prevScrollPos, setPrevScrollPos] = useState(window.scrollY); | ||
const [hidden, setHidden] = useState(false); | ||
const [isScrolled, setIsScrolled] = useState(false); | ||
const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
|
||
useEffect(() => { | ||
const handleScroll = () => { | ||
|
@@ -22,6 +23,11 @@ function Navbar() { | |
|
||
return () => window.removeEventListener("scroll", handleScroll); | ||
}, [prevScrollPos]); | ||
|
||
const toggleMenu = () => { | ||
setIsMenuOpen(!isMenuOpen); | ||
}; | ||
|
||
return ( | ||
<header | ||
className={`header ${hidden ? "hide" : ""} ${ | ||
|
@@ -30,29 +36,19 @@ function Navbar() { | |
data-header | ||
> | ||
<div className="top_navbar_style"> | ||
<p style={{ fontWeight: "bolder", marginTop: "10px" }}> | ||
<p> | ||
Makhija Arcade, 35th Rd, Khar, Khar West, Mumbai, Maharashtra 400052 | ||
</p> | ||
|
||
<p style={{ fontWeight: "bolder", marginTop: "10px" }}> | ||
Daily : 8.00 am to 10.00 pm | ||
</p> | ||
<p style={{ fontWeight: "bolder", marginTop: "10px" }}> | ||
+91 9136036603 | ||
</p> | ||
<p>Daily : 8.00 am to 10.00 pm</p> | ||
<p>+91 9136036603</p> | ||
<a | ||
href="mailto:[email protected]" | ||
className="topbar-item link" | ||
> | ||
<div className="icon"> | ||
<ion-icon name="mail-outline" aria-hidden="true"></ion-icon> | ||
</div> | ||
<span | ||
className="span" | ||
style={{ fontWeight: "bolder", marginTop: "10px" }} | ||
> | ||
[email protected] | ||
</span> | ||
<span className="span">[email protected]</span> | ||
</a> | ||
</div> | ||
<div className="container"> | ||
|
@@ -62,14 +58,14 @@ function Navbar() { | |
width="160" | ||
height="50" | ||
alt="Grilli - Home" | ||
class="logohover" | ||
className="logohover" | ||
/> | ||
</a> | ||
<nav className="navbar" data-navbar> | ||
<nav className={`navbar ${isMenuOpen ? 'active' : ''}`} data-navbar> | ||
<button | ||
className="close-btn" | ||
aria-label="close menu" | ||
data-nav-toggler | ||
onClick={toggleMenu} | ||
> | ||
<ion-icon name="close-outline" aria-hidden="true"></ion-icon> | ||
</button> | ||
|
@@ -142,16 +138,21 @@ function Navbar() { | |
<button | ||
className="nav-open-btn" | ||
aria-label="open menu" | ||
data-nav-toggler | ||
onClick={toggleMenu} | ||
> | ||
<span className="line line-1"></span> | ||
<span className="line line-2"></span> | ||
<span className="line line-3"></span> | ||
</button> | ||
<div className="overlay" data-nav-toggler data-overlay></div> | ||
<div | ||
className={`overlay ${isMenuOpen ? 'active' : ''}`} | ||
onClick={toggleMenu} | ||
data-nav-toggler | ||
data-overlay | ||
></div> | ||
</div> | ||
</header> | ||
); | ||
} | ||
|
||
export default Navbar; | ||
export default Navbar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters