Skip to content

Commit f87eeca

Browse files
Merge pull request #209 from swamphacks/feat/team-card-tooltips
Tooltips for leave team and kick member
2 parents a6c58b3 + 140e47f commit f87eeca

1 file changed

Lines changed: 36 additions & 14 deletions

File tree

‎apps/web/src/features/Team/components/MyTeamCard.tsx‎

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/Button";
66
import { toast } from "react-toastify";
77
import TablerDoorExit from "~icons/tabler/door-exit";
88
import TablerCircleX from "~icons/tabler/circle-x";
9+
import { Tooltip } from "@/components/ui/Tooltip";
910

1011
interface Props {
1112
eventId: string;
@@ -46,13 +47,23 @@ export default function MyTeamCard({ eventId, userId, team }: Props) {
4647
<div className="w-full flex flex-row items-center justify-between">
4748
<h3 className="text-text-main text-2xl">{team.name}</h3>
4849

49-
<Button
50-
onClick={handleLeaveTeam}
51-
variant="icon"
52-
className="aspect-square p-2.5"
50+
<Tooltip
51+
tooltipProps={{
52+
label: "Leave Team",
53+
offset: 4,
54+
}}
55+
triggerProps={{
56+
delay: 150,
57+
}}
5358
>
54-
<TablerDoorExit className="w-5 h-5 text-red-600" />
55-
</Button>
59+
<Button
60+
onClick={handleLeaveTeam}
61+
variant="icon"
62+
className="aspect-square p-2.5"
63+
>
64+
<TablerDoorExit className="w-5 h-5 text-red-600" />
65+
</Button>
66+
</Tooltip>
5667
</div>
5768
<div className="flex flex-row text-text-secondary items-center gap-4">
5869
<AvatarStack
@@ -82,19 +93,30 @@ export default function MyTeamCard({ eventId, userId, team }: Props) {
8293

8394
{/* Only show kick button if the viewer is the owner and the member is not the owner */}
8495
{member.user_id !== team.owner_id && userId == team.owner_id && (
85-
<button
86-
type="button"
87-
onClick={() => handleKickMember(member.user_id)}
88-
className="ml-2 p-1 hover:text-red-500 cursor-pointer transition-all duration-150"
89-
aria-label={`Remove ${member.name}`}
96+
<Tooltip
97+
tooltipProps={{
98+
label: `Remove ${member.name || "member"}`,
99+
offset: 4,
100+
}}
101+
triggerProps={{
102+
delay: 150,
103+
}}
90104
>
91-
<TablerCircleX className="w-4 h-4" />
92-
</button>
105+
<Button
106+
variant="unstyled"
107+
className="ml-2 p-1"
108+
onClick={() => handleKickMember(member.user_id)}
109+
>
110+
<TablerCircleX className="w-5 h-5 hover:text-red-600 hover:cursor-pointer transition-colors duration-150" />
111+
</Button>
112+
</Tooltip>
93113
)}
94114

95115
{/* Indicate the owner */}
96116
{member.user_id === team.owner_id && (
97-
<span className="text-xs text-neutral-500">(Owner)</span>
117+
<span className="text-xs text-neutral-500 select-none">
118+
(Owner)
119+
</span>
98120
)}
99121
</li>
100122
))}

0 commit comments

Comments
 (0)