40 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-04-18 15:07:15 -04:00
"use client"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
2024-04-18 15:25:20 -04:00
import { User } from "@/lib/types"
2024-04-18 15:07:15 -04:00
import { LogOut, Pencil } from "lucide-react"
2024-04-18 15:25:20 -04:00
export default function DashboardUserButton({ userData }: { userData: User }) {
2024-04-18 15:07:15 -04:00
return (
<DropdownMenu>
<DropdownMenuTrigger>
2024-04-18 15:25:20 -04:00
<div className="w-9 h-9 font-mono rounded-full overflow-hidden bg-gradient-to-t from-neutral-800 to-neutral-600 flex items-center justify-center text-sm font-medium">
{userData.name
.split(" ")
.slice(0, 2)
.map((name) => name[0].toUpperCase())}
</div>
2024-04-18 15:07:15 -04:00
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem className="cursor-pointer">
<Pencil className="mr-2 h-4 w-4" />
<span>Edit Profile</span>
2024-04-18 15:25:20 -04:00
{/* open modal with name and email (disabled) */}
2024-04-18 15:07:15 -04:00
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem className="!text-destructive cursor-pointer">
<LogOut className="mr-2 h-4 w-4" />
<span>Log Out</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}