-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Navbar for smaller screens (#50)
- Loading branch information
Showing
7 changed files
with
146 additions
and
168 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
ui/src/components/layout/navbar/nav-links.ts → .../components/layout/navbar/navbar-links.ts
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,21 @@ | ||
const NavbarMenuIcon = ({ open }: { open: boolean }) => ( | ||
<div className="flex flex-col justify-center items-center"> | ||
<span | ||
data-open={open} | ||
className={`bg-gray-600 block transition-all transform duration-300 ease-out h-0.5 w-5 | ||
rounded-lg data-[open=true]:rotate-45 data-[open=true]:translate-y-1 -translate-y-0.5`} | ||
/> | ||
<span | ||
data-open={open} | ||
className={`bg-gray-600 block transition-all transform duration-300 ease-out h-0.5 w-5 | ||
rounded-lg my-0.5 data-[open=true]:opacity-0 opacity-100`} | ||
/> | ||
<span | ||
data-open={open} | ||
className={`bg-gray-600 block transition transform duration-300 ease-out h-0.5 w-5 | ||
rounded-lg data-[open=true]:-rotate-45 data-[open=true]:-translate-y-1 translate-y-0.5`} | ||
/> | ||
</div> | ||
); | ||
|
||
export default NavbarMenuIcon; |
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,39 @@ | ||
'use client'; | ||
|
||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'; | ||
import User from '@/access/user'; | ||
import Link from 'next/link'; | ||
import { NavbarLinks } from './navbar-links'; | ||
import { useState } from 'react'; | ||
import Role from '@/access/role'; | ||
import NavbarMenuIcon from './navbar-menu-icon'; | ||
|
||
const NavbarMenu = ({ currentUser }: { currentUser: User }) => { | ||
const [open, setOpen] = useState(false); | ||
const handleClick = () => { | ||
setOpen(!open); | ||
}; | ||
|
||
return ( | ||
<Sheet open={open}> | ||
<SheetTrigger className="mr-3 lg:hidden" onClick={handleClick} aria-label="Open navigation menu"> | ||
<NavbarMenuIcon open={open} aria-hidden="true" /> | ||
</SheetTrigger> | ||
|
||
<SheetContent className="mt-[3.9rem] text-xl pt-5 lg:hidden" side="top" onClickOutside={handleClick}> | ||
<nav className="container flex flex-col space-y-5 h-1/4"> | ||
{NavbarLinks | ||
.filter((navbarLink) => | ||
currentUser.roles.includes(Role.ADMIN) || | ||
currentUser.roles.includes(navbarLink.role)) | ||
.map((navbarLink) => | ||
<Link href={navbarLink.link} key={navbarLink.name} className="hover:text-uh-teal"> | ||
{navbarLink.name} | ||
</Link>)} | ||
</nav> | ||
</SheetContent> | ||
</Sheet> | ||
); | ||
}; | ||
|
||
export default NavbarMenu; |
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
Oops, something went wrong.