forked from joschan21/quill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
312 additions
and
85 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Binary file not shown.
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
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
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
'use client' | ||
|
||
import { ArrowRight, Menu } from 'lucide-react' | ||
import Link from 'next/link' | ||
import { usePathname } from 'next/navigation' | ||
import { useEffect, useState } from 'react' | ||
|
||
const MobileNav = ({ isAuth }: { isAuth: boolean }) => { | ||
const [isOpen, setOpen] = useState<boolean>(false) | ||
|
||
const toggleOpen = () => setOpen((prev) => !prev) | ||
|
||
const pathname = usePathname() | ||
|
||
useEffect(() => { | ||
if (isOpen) toggleOpen() | ||
}, [pathname]) | ||
|
||
const closeOnCurrent = (href: string) => { | ||
if (pathname === href) { | ||
toggleOpen() | ||
} | ||
} | ||
|
||
return ( | ||
<div className='sm:hidden'> | ||
<Menu | ||
onClick={toggleOpen} | ||
className='relative z-50 h-5 w-5 text-zinc-700' | ||
/> | ||
|
||
{isOpen ? ( | ||
<div className='fixed animate-in slide-in-from-top-5 fade-in-20 inset-0 z-0 w-full'> | ||
<ul className='absolute bg-white border-b border-zinc-200 shadow-xl grid w-full gap-3 px-10 pt-20 pb-8'> | ||
{!isAuth ? ( | ||
<> | ||
<li> | ||
<Link | ||
onClick={() => | ||
closeOnCurrent('/sign-up') | ||
} | ||
className='flex items-center w-full font-semibold text-green-600' | ||
href='/sign-up'> | ||
Get started | ||
<ArrowRight className='ml-2 h-5 w-5' /> | ||
</Link> | ||
</li> | ||
<li className='my-3 h-px w-full bg-gray-300' /> | ||
<li> | ||
<Link | ||
onClick={() => | ||
closeOnCurrent('/sign-in') | ||
} | ||
className='flex items-center w-full font-semibold' | ||
href='/sign-in'> | ||
Sign in | ||
</Link> | ||
</li> | ||
<li className='my-3 h-px w-full bg-gray-300' /> | ||
<li> | ||
<Link | ||
onClick={() => | ||
closeOnCurrent('/pricing') | ||
} | ||
className='flex items-center w-full font-semibold' | ||
href='/pricing'> | ||
Pricing | ||
</Link> | ||
</li> | ||
</> | ||
) : ( | ||
<> | ||
<li> | ||
<Link | ||
onClick={() => | ||
closeOnCurrent('/dashboard') | ||
} | ||
className='flex items-center w-full font-semibold' | ||
href='/dashboard'> | ||
Dashboard | ||
</Link> | ||
</li> | ||
<li className='my-3 h-px w-full bg-gray-300' /> | ||
<li> | ||
<Link | ||
className='flex items-center w-full font-semibold' | ||
href='/sign-out'> | ||
Sign out | ||
</Link> | ||
</li> | ||
</> | ||
)} | ||
</ul> | ||
</div> | ||
) : null} | ||
</div> | ||
) | ||
} | ||
|
||
export default MobileNav |
Oops, something went wrong.