-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
72f044a
commit d231f1b
Showing
4 changed files
with
80 additions
and
55 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
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
62 changes: 62 additions & 0 deletions
62
apps/website/src/components/modules/navbar/mobile-menu.tsx
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,62 @@ | ||
'use client'; | ||
|
||
import * as React from 'react'; | ||
import Link from 'next/link'; | ||
import { MenuIcon, XIcon } from 'lucide-react'; | ||
import { $path } from 'next-typesafe-url'; | ||
import { UserButton, SignInButton } from '@clerk/nextjs'; | ||
|
||
import * as Drawer from 'park-ui/drawer'; | ||
import { IconButton } from 'park-ui/icon-button'; | ||
import { Button } from 'shadcn-ui/button'; | ||
import { RealmDropdown } from 'common/realm-dropdown'; | ||
|
||
type Props = Drawer.RootProps & { userId: string | null }; | ||
|
||
export const MobileMenu = ({ userId, ...props }: Props) => { | ||
const [open, setOpen] = React.useState(false); | ||
|
||
return ( | ||
<Drawer.Root {...props} open={open} onOpenChange={(details) => setOpen(details.open)}> | ||
<Drawer.Trigger asChild> | ||
<IconButton variant="ghost"> | ||
<MenuIcon /> | ||
</IconButton> | ||
</Drawer.Trigger> | ||
<Drawer.Backdrop /> | ||
<Drawer.Positioner className="right-0"> | ||
<Drawer.Content> | ||
<Drawer.Header className="flex items-center justify-between"> | ||
<Drawer.Title>Auctionoton</Drawer.Title> | ||
<Drawer.CloseTrigger asChild> | ||
<IconButton variant="ghost"> | ||
<XIcon /> | ||
</IconButton> | ||
</Drawer.CloseTrigger> | ||
</Drawer.Header> | ||
<Drawer.Body className="space-y-4"> | ||
<RealmDropdown onOpen={() => setOpen(false)} /> | ||
{userId && ( | ||
<Button asChild variant="outline"> | ||
<Link href={$path({ route: '/user/dashboard' })} onClick={() => setOpen(false)}> | ||
Dashboard | ||
</Link> | ||
</Button> | ||
)} | ||
</Drawer.Body> | ||
<Drawer.Footer gap="3"> | ||
<div className="flex items-center gap-2"> | ||
{userId ? ( | ||
<UserButton /> | ||
) : ( | ||
<Button asChild variant="outline"> | ||
<SignInButton mode="modal" /> | ||
</Button> | ||
)} | ||
</div> | ||
</Drawer.Footer> | ||
</Drawer.Content> | ||
</Drawer.Positioner> | ||
</Drawer.Root> | ||
); | ||
}; |