Skip to content

Commit

Permalink
Add theme toggle and settings link to sidebar user navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
athrael-soju committed Nov 15, 2024
1 parent ba90a74 commit 73252f1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/sidebar-user-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';
import { ChevronUp } from 'lucide-react';
import { ChevronUp, Hammer, Moon, Sun } from 'lucide-react';
import Image from 'next/image';
import Link from 'next/link';
import type { User } from 'next-auth';
import { signOut } from 'next-auth/react';
import { useTheme } from 'next-themes';
Expand Down Expand Up @@ -46,8 +47,19 @@ export function SidebarUserNav({ user }: { user: User }) {
className="cursor-pointer"
onSelect={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
>
{theme === 'light' ? (
<Moon className="mr-2 size-4" />
) : (
<Sun className="mr-2 size-4" />
)}
{`Toggle ${theme === 'light' ? 'dark' : 'light'} mode`}
</DropdownMenuItem>
<Link href="/settings" passHref>
<DropdownMenuItem>
<Hammer className="mr-2 size-4" />
{`Settings`}
</DropdownMenuItem>
</Link>
<DropdownMenuSeparator />
<DropdownMenuItem asChild>
<button
Expand All @@ -67,4 +79,4 @@ export function SidebarUserNav({ user }: { user: User }) {
</SidebarMenuItem>
</SidebarMenu>
);
}
}

0 comments on commit 73252f1

Please sign in to comment.