Skip to content

Commit

Permalink
Introduce Dropdown component
Browse files Browse the repository at this point in the history
  • Loading branch information
svemat01 committed Dec 3, 2024
1 parent 176ac85 commit e6f896d
Show file tree
Hide file tree
Showing 4 changed files with 512 additions and 46 deletions.
48 changes: 17 additions & 31 deletions web/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable jsx-a11y/alt-text */
/* eslint-disable no-undef */
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import { Link } from '@tanstack/react-router';
import { FileRoutesByPath } from '@tanstack/react-router';

import { useAuth } from '@/api/auth';
import { useApiMe } from '@/api/me';
import * as DropdownMenu from '@/components/ui/Dropdown';

import { AvatarHolder, getInitials } from './UserProfile';

Expand Down Expand Up @@ -75,37 +75,23 @@ export const Navbar = () => {
</button>
</DropdownMenu.Trigger>

<DropdownMenu.Portal>
<DropdownMenu.Content
className="DropdownMenuContent"
sideOffset={5}
<DropdownMenu.Content sideOffset={5}>
<DropdownMenu.Item asChild>
<Link to="/sessions">Sessions</Link>
</DropdownMenu.Item>
<DropdownMenu.Item asChild>
<Link to="/settings">Settings</Link>
</DropdownMenu.Item>

<DropdownMenu.Separator />
<DropdownMenu.Item
onClick={() => {
clearAuthToken();
}}
>
<DropdownMenu.Item asChild>
<Link
to="/settings"
className="DropdownMenuItem"
>
Settings
</Link>
</DropdownMenu.Item>
<DropdownMenu.Item asChild>
<Link
to="/sessions"
className="DropdownMenuItem"
>
Sessions
</Link>
</DropdownMenu.Item>
<DropdownMenu.Item
className="DropdownMenuItem"
onClick={() => {
clearAuthToken();
}}
>
Logout
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Portal>
Logout
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
</div>
)}
Expand Down
Loading

0 comments on commit e6f896d

Please sign in to comment.