forked from Codehagen/Badget
-
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.
create hamburger menu and fix responsiveness (Codehagen#218)
- Loading branch information
1 parent
bb221ac
commit aaab29a
Showing
8 changed files
with
78 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,3 +122,5 @@ export function SidebarNav({ isCollapsed }: { isCollapsed: boolean }) { | |
</nav> | ||
); | ||
} | ||
|
||
export { ExpandedItem }; |
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
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,66 @@ | ||
"use client"; | ||
|
||
import { | ||
Sheet, | ||
SheetContent, | ||
SheetDescription, | ||
SheetHeader, | ||
SheetTitle, | ||
SheetTrigger, | ||
} from "@/components/ui/sheet" | ||
|
||
import { AlignJustify } from "lucide-react"; | ||
import Link from "next/link"; | ||
import { Button } from "@/components/ui/button"; | ||
import { sideNavItems, siteConfig } from "@/app/config"; | ||
import { Icons } from "@/components/shared/icons"; | ||
import { ExpandedItem } from "../(workspaceId)/_components/sidebar-nav"; | ||
import { useParams, usePathname } from "next/navigation"; | ||
import { Separator } from "@/components/ui/separator"; | ||
|
||
export default function HamburgerMenu() { | ||
const params = useParams<{ workspaceId: string }>(); | ||
const path = usePathname(); | ||
|
||
const pathname = path.replace(`/${params.workspaceId}`, "") || "/"; | ||
const [_, currentPath] = pathname.split("/"); | ||
|
||
return ( | ||
<div className="flex lg:hidden"> | ||
<Sheet> | ||
<SheetTrigger> | ||
<AlignJustify /> | ||
</SheetTrigger> | ||
<SheetContent side={"left"}> | ||
<SheetHeader> | ||
<SheetTitle className="flex items-center space-x-2"> | ||
<Icons.logo /> | ||
<span className="inline-block font-urban text-xl font-bold"> | ||
{siteConfig.name} | ||
</span> | ||
</SheetTitle> | ||
</SheetHeader> | ||
|
||
{sideNavItems.map((group) => { | ||
return ( | ||
<> | ||
<Separator className="mb-2 mt-2" /> | ||
<div className="flex flex-col gap-1 p-2" key={group.group}> | ||
{group.items.map((link, idx) => { | ||
return ( | ||
<ExpandedItem | ||
key={link.href + idx} | ||
item={link} | ||
currentPath={"/" + currentPath} | ||
/> | ||
) | ||
})} | ||
</div> | ||
</> | ||
); | ||
})} | ||
</SheetContent> | ||
</Sheet> | ||
</div> | ||
) | ||
} |
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