mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
Setup Inertia (#593)
This commit is contained in:
20
resources/js/components/user-info.tsx
Normal file
20
resources/js/components/user-info.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { useInitials } from '@/hooks/use-initials';
|
||||
import { type User } from '@/types/user';
|
||||
|
||||
export function UserInfo({ user, showEmail = false }: { user: User; showEmail?: boolean }) {
|
||||
const getInitials = useInitials();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Avatar className="h-8 w-8 overflow-hidden rounded-full">
|
||||
<AvatarImage src={user.avatar} alt={user.name} />
|
||||
<AvatarFallback className="rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white">{getInitials(user.name)}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="grid flex-1 text-left text-sm leading-tight">
|
||||
<span className="truncate font-medium">{user.name}</span>
|
||||
{showEmail && <span className="text-muted-foreground truncate text-xs">{user.email}</span>}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user