tooltip
This commit is contained in:
@@ -5,11 +5,22 @@ type Props = {
|
||||
src?: string | null;
|
||||
alt?: string;
|
||||
className?: string;
|
||||
showTooltip?: boolean;
|
||||
};
|
||||
|
||||
const UserAvatar: FC<Props> = ({ src, alt = "", className = "size-6" }) => (
|
||||
<div className={`${className} rounded-full overflow-hidden shrink-0 bg-[#D0D0D0]`}>
|
||||
<img src={src || AvatarImage} alt={alt} className="size-full object-cover" />
|
||||
const UserAvatar: FC<Props> = ({ src, alt = "", className = "size-6", showTooltip = true }) => (
|
||||
<div className={`relative group/avatar ${className} rounded-full overflow-visible shrink-0`}>
|
||||
<div className="size-full rounded-full overflow-hidden bg-[#D0D0D0]">
|
||||
<img src={src || AvatarImage} alt={alt} className="size-full object-cover" />
|
||||
</div>
|
||||
{showTooltip && alt ? (
|
||||
<span
|
||||
role="tooltip"
|
||||
className="pointer-events-none absolute bottom-full left-1/2 z-20 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded-md bg-[#292D32] px-2 py-1 text-[10px] text-white opacity-0 transition-opacity group-hover/avatar:opacity-100"
|
||||
>
|
||||
{alt}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ const CommentItem: FC<Props> = ({ comment, taskId }) => {
|
||||
return (
|
||||
<div className="bg-white/25 rounded-xl p-3">
|
||||
<div className="flex items-start gap-2">
|
||||
<UserAvatar src={comment.user?.profilePic} alt={authorName} className="size-7" />
|
||||
<UserAvatar src={comment.user?.profilePic} alt={authorName} className="size-7" showTooltip={false} />
|
||||
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
|
||||
@@ -72,7 +72,7 @@ const TaskDetailUsersList: FC<Props> = ({
|
||||
onToggle={() => onToggle(user.id)}
|
||||
ariaLabel={user.name}
|
||||
/>
|
||||
<UserAvatar src={user.avatar} alt={user.name} />
|
||||
<UserAvatar src={user.avatar} alt={user.name} showTooltip={false} />
|
||||
<div className="text-[10px]">{user.name}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -155,7 +155,7 @@ const CreateProjectSidebar: FC<Props> = ({
|
||||
) : (
|
||||
selectedUsers.map((user) => (
|
||||
<div key={user.id} className="bg-[#EBEEF5] flex gap-2 text-xs items-center px-2 py-2 rounded-lg">
|
||||
<UserAvatar src={user.profilePic} alt={user.name} />
|
||||
<UserAvatar src={user.profilePic} alt={user.name} showTooltip={false} />
|
||||
<div>{user.name}</div>
|
||||
<CloseCircle variant="Bold" className="size-4 cursor-pointer" color="red" onClick={() => handleRemoveUser(user.id)} />
|
||||
</div>
|
||||
|
||||
@@ -113,7 +113,7 @@ const CreateWorkspaceSidebar: FC<Props> = ({
|
||||
key={user.id}
|
||||
className="bg-[#EBEEF5] flex gap-2 text-xs items-center px-2 py-2 rounded-lg"
|
||||
>
|
||||
<UserAvatar src={user.profilePic} alt={user.name} />
|
||||
<UserAvatar src={user.profilePic} alt={user.name} showTooltip={false} />
|
||||
<div>{user.name}</div>
|
||||
<CloseCircle
|
||||
variant="Bold"
|
||||
|
||||
Reference in New Issue
Block a user