diff --git a/components/Home/Navbar/MobileNav.tsx b/components/Home/Navbar/MobileNav.tsx index 853025d..731fb14 100644 --- a/components/Home/Navbar/MobileNav.tsx +++ b/components/Home/Navbar/MobileNav.tsx @@ -1,7 +1,9 @@ import {navLinks} from "@/constant/Constant"; import Link from "next/link"; -import React from "react"; +import React, {useContext} from "react"; import {CgClose} from "react-icons/cg"; +import {ThemeContext} from "@/components/provider/ThemeProvider"; +import {themeColors} from "@/components/Helper/ThemeColors"; type Props = { showNav: boolean; @@ -9,32 +11,55 @@ type Props = { }; const MobileNav = ({closeNav, showNav}: Props) => { - const navOpen = showNav ? "translate-x-0" : "translate-x-[-100%]"; + const navOpen = showNav ? "translate-y-0 opacity-100" : "-translate-y-20 opacity-0 pointer-events-none"; + const {theme, toggleTheme} = useContext(ThemeContext); + const colors = themeColors[theme]; + + const cleanDarkBackground = theme === "dark" ? "#2A2A2A" : colors.primaryBg; return ( -
- {/* overlay */} +
+ {/* overlay background */}
- {/* Navlinks */} + className={`fixed inset-0 z-[10000] transition-opacity duration-500 ${ + showNav ? "opacity-60 bg-black" : "opacity-0 pointer-events-none" + }`} + onClick={closeNav} + /> + + {/* nav menu */}
- {navLinks.map((link) => { - return ( +
+ {/* Close icon */} + + + {navLinks.map((link) => ( -

+

{link.label}

- ); - })} - {/* Close icon */} - + ))} + + {/* Theme toggle button */} + +
);