Skip to content

feat: add transition effect to mobile navbar #655

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
8 changes: 5 additions & 3 deletions components/Navbar/navDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ const NavDrop = forwardRef((props, ref)=> {
<div
className='min-h-[50px] cursor-pointer'
data-test={`nav-${link.title}`}
onClick={() =>
onClick={(e) =>
show === link.title ? setShow(null) : setShow(link.title)
}
>
{link.subMenu ? (
<div>
<div className='flex'>
<div className='flex items-center' onClick={(e) => e.preventDefault()}>
<div className='text-white'>{link.title}</div>
<Dropdown
className={`transition-transform duration-700`}
color="white"
className={`ml-2 transition-transform duration-500 ${show === link.title ? "rotate-180" : "rotate-0"
}`}
/>
</div>
{show && show === link.title && (
Expand Down
15 changes: 11 additions & 4 deletions components/Navbar/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function Navbar() {
>
<div className="p-5 flex justify-between h-[75px] w-full items-center">
<div
className="flex items-center sm:justify-between sm:w-full"
className="flex items-center sm:justify-between sm:w-full z-[99]"
data-test="nav-Home"
>
<Link href="/">
Expand All @@ -94,7 +94,7 @@ function Navbar() {
</Link>
</div>
{isTablet ? (
<div data-test="nav-Hamberger">
<div data-test="nav-Hamberger" className="z-[99]">
{drop ? (
<button>
<Cancel />
Expand Down Expand Up @@ -136,7 +136,7 @@ function Navbar() {
<span className="after:absolute after:-bottom-1 after:right-1/2 after:w-0 after:transition-all after:h-0.5 after:bg-white after:group-hover:w-3/6"></span>
{show === link.title && link.subMenu && (
<div
className="subMenu absolute z-[9] mt-8 w-[150px] rounded-md left-[-15px] gradient-bg px-2 py-1 flex flex-col justify-center space-y-0"
className="subMenu absolute z-[9] mt-8 min-w-[150px] whitespace-nowrap rounded-md left-[-15px] gradient-bg px-2 py-1 flex flex-col justify-center space-y-0"
onMouseEnter={handleSubMenuEnter}
onMouseLeave={handleSubMenuLeave}
>
Expand All @@ -162,7 +162,14 @@ function Navbar() {
))}
</div>
)}
{isTablet && drop && <NavDrop setDrop={setDrop} ref={menuRef} />}
{isTablet && (
<div
className={`fixed inset-0 z-[98] bg-[#1B1130]/90 backdrop-blur-md transition-all duration-500 ${drop ? "opacity-100" : "opacity-0 -translate-y-full pointer-events-none"
}`}
>
{drop && <NavDrop setDrop={setDrop} ref={menuRef} />}
</div>
)}
</div>
</div>
</div>
Expand Down