|
| 1 | +"use client"; |
| 2 | +import { |
| 3 | + DropdownMenu, |
| 4 | + DropdownMenuContent, |
| 5 | + DropdownMenuItem, |
| 6 | + DropdownMenuSeparator, |
| 7 | + DropdownMenuTrigger, |
| 8 | +} from "@/components/ui/dropdown-menu"; |
| 9 | +import { Avatar, AvatarFallback } from "@/components/ui/avatar"; |
| 10 | +import { |
| 11 | + ArrowUp, |
| 12 | + Code, |
| 13 | + Download, |
| 14 | + HelpCircle, |
| 15 | + LogOut, |
| 16 | + Settings, |
| 17 | + ShoppingCart, |
| 18 | + Trash2, |
| 19 | + User, |
| 20 | +} from "lucide-react"; |
| 21 | +import React, { useState } from "react"; |
| 22 | + |
| 23 | +{ |
| 24 | + /* User dropdown */ |
| 25 | +} |
| 26 | + |
| 27 | +export default function UserDropdown() { |
| 28 | + const [userDropdownOpen, setUserDropdownOpen] = useState(false); |
| 29 | + const username = "Max Mustermann"; // TODO change |
| 30 | + const avatarLetter = username.charAt(0); |
| 31 | + const firstName = "Max"; //TODO chnage |
| 32 | + |
| 33 | + return ( |
| 34 | + <DropdownMenu open={userDropdownOpen} onOpenChange={setUserDropdownOpen}> |
| 35 | + <DropdownMenuTrigger asChild> |
| 36 | + <div className="flex flex-row items-center gap-2"> |
| 37 | + <button className="flex items-center gap-2 hover:bg-gray-100 rounded-full p-1 focus:outline-none hover:cursor-pointer"> |
| 38 | + <Avatar className="w-8 h-8 bg-blue-600"> |
| 39 | + <AvatarFallback className="bg-blue-600 text-white text-sm font-medium"> |
| 40 | + {avatarLetter} |
| 41 | + </AvatarFallback> |
| 42 | + </Avatar> |
| 43 | + </button> |
| 44 | + <span>Hey {firstName} !</span> |
| 45 | + </div> |
| 46 | + </DropdownMenuTrigger> |
| 47 | + <DropdownMenuContent align="start" className="w-56 mt-3"> |
| 48 | + <div className="flex flex-col items-center gap-3 p-3 "> |
| 49 | + <Avatar className="w-10 h-10 bg-blue-600"> |
| 50 | + <AvatarFallback className="bg-blue-600 text-white font-medium"> |
| 51 | + {avatarLetter} |
| 52 | + </AvatarFallback> |
| 53 | + </Avatar> |
| 54 | + <span className="font-medium">{username}</span> |
| 55 | + </div> |
| 56 | + <DropdownMenuSeparator /> |
| 57 | + <DropdownMenuItem className="flex items-center gap-3 px-3 py-2"> |
| 58 | + <User className="w-4 h-4" /> |
| 59 | + Profile |
| 60 | + </DropdownMenuItem> |
| 61 | + |
| 62 | + <DropdownMenuItem className="flex items-center gap-3 px-3 py-2"> |
| 63 | + <LogOut className="w-4 h-4" /> |
| 64 | + Log out |
| 65 | + </DropdownMenuItem> |
| 66 | + </DropdownMenuContent> |
| 67 | + </DropdownMenu> |
| 68 | + ); |
| 69 | +} |
0 commit comments