mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
1d7b3efb80
* [WEB-1148] chore: icons updates for consistency across platform. * chore: update logic for rendering custom lead icon. * chore: update Icon prop name. * chore: update `Icon` prop to `icon`.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { observer } from "mobx-react";
|
|
// icons
|
|
import { LucideIcon, Users } from "lucide-react";
|
|
// ui
|
|
import { Avatar, AvatarGroup } from "@plane/ui";
|
|
// hooks
|
|
import { useMember } from "@/hooks/store";
|
|
|
|
type AvatarProps = {
|
|
showTooltip: boolean;
|
|
userIds: string | string[] | null;
|
|
icon?: LucideIcon;
|
|
};
|
|
|
|
export const ButtonAvatars: React.FC<AvatarProps> = observer((props) => {
|
|
const { showTooltip, userIds, icon: Icon } = props;
|
|
// store hooks
|
|
const { getUserDetails } = useMember();
|
|
|
|
if (Array.isArray(userIds)) {
|
|
if (userIds.length > 0)
|
|
return (
|
|
<AvatarGroup size="md" showTooltip={!showTooltip}>
|
|
{userIds.map((userId) => {
|
|
const userDetails = getUserDetails(userId);
|
|
|
|
if (!userDetails) return;
|
|
return <Avatar key={userId} src={userDetails.avatar} name={userDetails.display_name} />;
|
|
})}
|
|
</AvatarGroup>
|
|
);
|
|
} else {
|
|
if (userIds) {
|
|
const userDetails = getUserDetails(userIds);
|
|
return <Avatar src={userDetails?.avatar} name={userDetails?.display_name} size="md" showTooltip={!showTooltip} />;
|
|
}
|
|
}
|
|
|
|
return Icon ? (
|
|
<Icon className="h-3 w-3 flex-shrink-0" />
|
|
) : (
|
|
<Users className="h-3 w-3 flex-shrink-0" />
|
|
);
|
|
});
|