Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Mobile Menu Navigation #299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/assets/mobile-menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 64 additions & 4 deletions src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { FaQuestionCircle } from "react-icons/fa";
import ScrollToTop from "./ScrollToTop";
import { useGoogleLogin } from "@react-oauth/google";
import avatar from "../assets/avatar.png";
import mobile_menu from "../assets/mobile-menu.svg";

const Header = () => {
const [isLoggedIn, setisLoggedIn] = useState(true);
Expand Down Expand Up @@ -114,7 +115,7 @@ const Header = () => {
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out hidden md:flex items-center gap-2">
<span className="hidden md:block">
<HiHome />
</span>
Expand All @@ -127,7 +128,7 @@ const Header = () => {
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out hidden md:flex items-center gap-2">
<span className="hidden md:block">
<HiBuildingOffice />
</span>
Expand All @@ -140,7 +141,7 @@ const Header = () => {
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out hidden md:flex items-center gap-2">
<span className="hidden md:block">
<HiPhone />
</span>
Expand All @@ -153,7 +154,7 @@ const Header = () => {
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out hidden md:flex items-center gap-2">
<span className="hidden md:block">
<FaQuestionCircle />
</span>
Expand Down Expand Up @@ -210,7 +211,16 @@ const Header = () => {
</button>
</>
)}
<button onClick={() => {
setIsMenuOpen(!isMenuOpen);
}}
className="md:hidden">
<div className="navbar-burger flex items-center text-orange-600 p-3">
<img src={mobile_menu} className="block h-4 w-4 fill-current" />
</div>
</button>
</ul>

</div>
</div>
{isProfileOpen && !isLoggedIn ? (
Expand Down Expand Up @@ -245,6 +255,56 @@ const Header = () => {
) : (
<div></div>
)}

{isMenuOpen ? (
<div className="fixed top-0 left-0 z-20">
<div class="shadow-xl w-72 py-14 bg-white h-screen">
<ul className="flex-col text-[16px] px-4 py-8 sm:text-[16px] font-semibold md:font-normal items-center space-x-2 sm:space-x-3 md:space-x-4">
<NavLink
to="/"
className={({ isActive }) =>
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<span className="hidden md:block">
<HiHome />
</span>
Home
</li>
</NavLink>
<NavLink
to="/About"
className={({ isActive }) =>
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<span className="hidden md:block">
<HiBuildingOffice />
</span>
About
</li>
</NavLink>
<NavLink
to="/Contact"
className={({ isActive }) =>
isActive ? "text-orange-400 " : "text-black"
}
>
<li className="hover:text-orange-400 transition-all duration-300 ease-in-out flex items-center gap-2">
<span className="hidden md:block">
<HiPhone />
</span>
Contact
</li>
</NavLink>
</ul>
</div>
</div>
) : (<> </>)

}
</>
);
};
Expand Down