|
| 1 | +<script setup lang="ts"> |
| 2 | +import { ChevronsUpDown, LogOut } from 'lucide-vue-next' |
| 3 | +import { DropdownMenuPortal } from 'radix-vue' |
| 4 | +import { File05, Globe04, Lock01, Settings02 } from 'untitledui-js/vue' |
| 5 | +
|
| 6 | +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' |
| 7 | +import { |
| 8 | + DropdownMenu, |
| 9 | + DropdownMenuContent, |
| 10 | + DropdownMenuGroup, |
| 11 | + DropdownMenuItem, |
| 12 | + DropdownMenuLabel, |
| 13 | + DropdownMenuSeparator, |
| 14 | + DropdownMenuSub, |
| 15 | + DropdownMenuSubContent, |
| 16 | + DropdownMenuSubTrigger, |
| 17 | + DropdownMenuTrigger, |
| 18 | +} from '@/components/ui/dropdown-menu' |
| 19 | +
|
| 20 | +const props = defineProps<{ |
| 21 | + user: { |
| 22 | + name: string |
| 23 | + avatar: string |
| 24 | + } |
| 25 | +}>() |
| 26 | +</script> |
| 27 | + |
| 28 | +<template> |
| 29 | + <DropdownMenu> |
| 30 | + <DropdownMenuTrigger> |
| 31 | + <div |
| 32 | + class="flex flex-row items-center gap-2 data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground" |
| 33 | + > |
| 34 | + <Avatar class="h-8 w-8 rounded-[10px]"> |
| 35 | + <AvatarImage class="bg-black" :src="props.user.avatar" :alt="props.user.name" /> |
| 36 | + <AvatarFallback class="rounded-[10px]"> CN </AvatarFallback> |
| 37 | + </Avatar> |
| 38 | + <div class="flex flex-1 flex-col gap-0 text-left text-sm leading-tight"> |
| 39 | + <span class="truncate font-semibold">{{ props.user.name }}</span> |
| 40 | + <span class="truncate text-xs">Logged as</span> |
| 41 | + </div> |
| 42 | + <ChevronsUpDown class="ml-auto size-4" /> |
| 43 | + </div> |
| 44 | + </DropdownMenuTrigger> |
| 45 | + <DropdownMenuContent |
| 46 | + class="bottom w-[--reka-dropdown-menu-trigger-width] min-w-56 rounded-lg" |
| 47 | + align="end" |
| 48 | + :side-offset="4" |
| 49 | + > |
| 50 | + <DropdownMenuLabel class="p-0 font-normal"> |
| 51 | + <div class="flex items-center gap-2 px-1 py-1.5 text-left text-sm"> |
| 52 | + <Avatar class="h-8 w-8 rounded-lg"> |
| 53 | + <AvatarImage :src="props.user.avatar" :alt="props.user.name" /> |
| 54 | + <AvatarFallback class="rounded-lg"> CN </AvatarFallback> |
| 55 | + </Avatar> |
| 56 | + <div class="grid flex-1 text-left text-sm leading-tight"> |
| 57 | + <span class="truncate font-semibold">{{ props.user.name }}</span> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + </DropdownMenuLabel> |
| 61 | + <DropdownMenuSeparator /> |
| 62 | + <DropdownMenuGroup> |
| 63 | + <DropdownMenuItem> |
| 64 | + <Settings02 /> |
| 65 | + Settings |
| 66 | + </DropdownMenuItem> |
| 67 | + <DropdownMenuSub> |
| 68 | + <DropdownMenuSubTrigger> |
| 69 | + <Globe04 /> |
| 70 | + Language |
| 71 | + </DropdownMenuSubTrigger> |
| 72 | + <DropdownMenuPortal> |
| 73 | + <DropdownMenuSubContent> |
| 74 | + <DropdownMenuItem> |
| 75 | + <span>Russian</span> |
| 76 | + </DropdownMenuItem> |
| 77 | + <DropdownMenuItem> |
| 78 | + <span>English</span> |
| 79 | + </DropdownMenuItem> |
| 80 | + </DropdownMenuSubContent> |
| 81 | + </DropdownMenuPortal> |
| 82 | + </DropdownMenuSub> |
| 83 | + </DropdownMenuGroup> |
| 84 | + <DropdownMenuSeparator /> |
| 85 | + <DropdownMenuGroup> |
| 86 | + <DropdownMenuItem> |
| 87 | + <Lock01 /> |
| 88 | + Privacy Policy |
| 89 | + </DropdownMenuItem> |
| 90 | + <DropdownMenuItem> |
| 91 | + <File05 /> |
| 92 | + Terms of Service |
| 93 | + </DropdownMenuItem> |
| 94 | + </DropdownMenuGroup> |
| 95 | + <DropdownMenuSeparator /> |
| 96 | + <DropdownMenuItem> |
| 97 | + <LogOut /> |
| 98 | + Log out |
| 99 | + </DropdownMenuItem> |
| 100 | + </DropdownMenuContent> |
| 101 | + </DropdownMenu> |
| 102 | +</template> |
0 commit comments