2023-05-19 13:02:09 +02:00
|
|
|
import { Avatar } from "#/ui/Avatar";
|
2023-05-17 13:46:44 +02:00
|
|
|
import { ChevronDownIcon } from "@heroicons/react/24/outline";
|
|
|
|
|
import Link from "next/link";
|
2023-04-20 17:07:26 +02:00
|
|
|
|
2023-04-19 10:37:35 +02:00
|
|
|
type Props = {
|
2023-06-21 14:11:04 +02:00
|
|
|
loginName?: string;
|
2023-05-17 15:25:25 +02:00
|
|
|
displayName?: string;
|
2023-05-17 13:46:44 +02:00
|
|
|
showDropdown: boolean;
|
2023-04-19 10:37:35 +02:00
|
|
|
};
|
|
|
|
|
|
2023-05-17 15:25:25 +02:00
|
|
|
export default function UserAvatar({
|
|
|
|
|
loginName,
|
|
|
|
|
displayName,
|
|
|
|
|
showDropdown,
|
|
|
|
|
}: Props) {
|
2023-04-19 10:37:35 +02:00
|
|
|
return (
|
2023-06-15 13:58:32 +02:00
|
|
|
<div className="flex h-full flex-row items-center rounded-full border p-[1px] dark:border-white/20">
|
2023-04-20 17:07:26 +02:00
|
|
|
<div>
|
2023-05-17 13:46:44 +02:00
|
|
|
<Avatar
|
2023-05-19 13:02:09 +02:00
|
|
|
size="small"
|
2023-06-21 14:11:04 +02:00
|
|
|
name={displayName ?? loginName ?? "A"}
|
|
|
|
|
loginName={loginName ?? "A"}
|
2023-05-17 13:46:44 +02:00
|
|
|
/>
|
2023-04-20 17:07:26 +02:00
|
|
|
</div>
|
2023-05-17 13:46:44 +02:00
|
|
|
<span className="ml-4 text-14px">{loginName}</span>
|
|
|
|
|
<span className="flex-grow"></span>
|
|
|
|
|
{showDropdown && (
|
|
|
|
|
<Link
|
|
|
|
|
href="/accounts"
|
2023-06-15 13:58:32 +02:00
|
|
|
className="ml-4 flex items-center justify-center p-1 hover:bg-black/10 dark:hover:bg-white/10 rounded-full mr-1 transition-all"
|
2023-05-17 13:46:44 +02:00
|
|
|
>
|
|
|
|
|
<ChevronDownIcon className="h-4 w-4" />
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
2023-04-19 10:37:35 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|