Skip to content

Commit 0a24de1

Browse files
authored
Merge pull request #446 from CodebilityDev/fix/status-tooltip-overflow
Fix: Allow status tooltip (e.g., “Graduated”) to display outside the card boundary
2 parents 787a098 + e9e16a3 commit 0a24de1

2 files changed

Lines changed: 58 additions & 43 deletions

File tree

‎apps/codebility/app/(marketing)/profiles/_components/CodevCard.tsx‎

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,36 @@ const STATUS_CONFIG: Record<
3737
> = {
3838
TRAINING: {
3939
label: "Training",
40-
className: "bg-yellow-500/20 backdrop-blur-sm text-yellow-200 border border-yellow-500/30 dark:bg-yellow-500/10 dark:text-yellow-300",
40+
className:
41+
"bg-yellow-500/20 backdrop-blur-sm text-yellow-200 border border-yellow-500/30 dark:bg-yellow-500/10 dark:text-yellow-300",
4142
},
4243
GRADUATED: {
4344
label: "Graduated",
44-
className: "bg-green-500/20 backdrop-blur-sm text-green-200 border border-green-500/30 dark:bg-green-500/10 dark:text-green-300",
45+
className:
46+
"bg-green-500/20 backdrop-blur-sm text-green-200 border border-green-500/30 dark:bg-green-500/10 dark:text-green-300",
4547
},
4648
INACTIVE: {
4749
label: "Inactive",
48-
className: "bg-gray-500/20 backdrop-blur-sm text-gray-200 border border-gray-500/30 dark:bg-gray-500/10 dark:text-gray-300",
50+
className:
51+
"bg-gray-500/20 backdrop-blur-sm text-gray-200 border border-gray-500/30 dark:bg-gray-500/10 dark:text-gray-300",
4952
},
5053
MENTOR: {
5154
label: "Mentor",
52-
className: "bg-purple-500/20 backdrop-blur-sm text-purple-200 border border-purple-500/30 dark:bg-purple-500/10 dark:text-purple-300",
55+
className:
56+
"bg-purple-500/20 backdrop-blur-sm text-purple-200 border border-purple-500/30 dark:bg-purple-500/10 dark:text-purple-300",
5357
},
5458
ADMIN: {
5559
label: "Admin",
56-
className: "bg-blue-500/20 backdrop-blur-sm text-blue-200 border border-blue-500/30 dark:bg-blue-500/10 dark:text-blue-300",
60+
className:
61+
"bg-blue-500/20 backdrop-blur-sm text-blue-200 border border-blue-500/30 dark:bg-blue-500/10 dark:text-blue-300",
5762
},
5863
DEPLOYED: {
5964
label: "Deployed",
60-
className: "bg-indigo-500/20 backdrop-blur-sm text-indigo-200 border border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-300",
65+
className:
66+
"bg-indigo-500/20 backdrop-blur-sm text-indigo-200 border border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-300",
6167
},
6268
};
63-
69+
6470
const CodevCard = ({ codev, color }: Props) => {
6571
const [hovered, setHovered] = useState(false);
6672
const springConfig = { stiffness: 100, damping: 5 };
@@ -118,10 +124,10 @@ const CodevCard = ({ codev, color }: Props) => {
118124
onMouseEnter={() => setHovered(true)}
119125
onMouseLeave={() => setHovered(false)}
120126
>
121-
<div className="bg-white/10 backdrop-blur-md dark:bg-white/5 hover:bg-white/20 dark:hover:bg-white/10 flex h-full w-full flex-col items-center justify-between rounded-lg p-4 shadow-2xl transition-all duration-300 border border-white/20 dark:border-white/10 relative overflow-hidden group">
127+
<div className="group relative flex h-full w-full flex-col items-center justify-between rounded-lg border border-white/20 bg-white/10 p-4 shadow-2xl backdrop-blur-md transition-all duration-300 hover:bg-white/20 dark:border-white/10 dark:bg-white/5 dark:hover:bg-white/10">
122128
{/* Background decoration */}
123-
<div className="absolute inset-0 bg-gradient-to-br from-customBlue-50/30 to-purple-50/30 dark:from-customBlue-950/10 dark:to-purple-950/10 opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
124-
<div className="absolute -top-4 -right-4 h-32 w-32 rounded-full bg-gradient-to-br from-yellow-400/10 to-orange-400/10 blur-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
129+
<div className="from-customBlue-50/30 dark:from-customBlue-950/10 absolute inset-0 bg-gradient-to-br to-purple-50/30 opacity-0 transition-opacity duration-300 group-hover:opacity-100 dark:to-purple-950/10" />
130+
<div className="absolute -right-4 -top-4 h-32 w-32 rounded-full bg-gradient-to-br from-yellow-400/10 to-orange-400/10 opacity-0 blur-2xl transition-opacity duration-500 group-hover:opacity-100" />
125131
<div className="grid w-full grid-cols-4 gap-2">
126132
<div className="col-span-1" />
127133
<div className="relative col-span-2 flex justify-center">
@@ -180,9 +186,9 @@ const CodevCard = ({ codev, color }: Props) => {
180186
<p
181187
className={cn(
182188
"rounded-full border-2 p-2 text-[9px]",
183-
codev.availability_status
184-
? "bg-green-500 border-green-600"
185-
: "bg-red-500 border-red-600",
189+
codev.availability_status
190+
? "border-green-600 bg-green-500"
191+
: "border-red-600 bg-red-500",
186192
)}
187193
></p>
188194
</div>
@@ -195,13 +201,13 @@ const CodevCard = ({ codev, color }: Props) => {
195201
<Button
196202
variant="outline"
197203
size="icon"
198-
className="bg-white/20 backdrop-blur-sm dark:bg-white/10 hover:bg-white/30 dark:hover:bg-white/20 border-white/30 dark:border-white/20 h-8 w-8 rounded-full transition-all duration-300"
204+
className="h-8 w-8 rounded-full border-white/30 bg-white/20 backdrop-blur-sm transition-all duration-300 hover:bg-white/30 dark:border-white/20 dark:bg-white/10 dark:hover:bg-white/20"
199205
>
200206
<BookOpenIcon className="h-3.5 w-3.5" />
201207
</Button>
202208
</Link>
203209
</TooltipTrigger>
204-
<TooltipContent className="bg-white/10 backdrop-blur-md dark:bg-white/5 border border-white/20 dark:border-white/10 px-2 py-1 text-xs text-white">
210+
<TooltipContent className="border border-white/20 bg-white/10 px-2 py-1 text-xs text-white backdrop-blur-md dark:border-white/10 dark:bg-white/5">
205211
Read Bio
206212
</TooltipContent>
207213
</Tooltip>
@@ -210,13 +216,15 @@ const CodevCard = ({ codev, color }: Props) => {
210216
</div>
211217
<div className="flex flex-col items-center gap-0.5">
212218
<div className="flex flex-col gap-1 text-center">
213-
<p className="md:text-md text-sm capitalize text-white dark:text-white lg:text-base relative z-10">
219+
<p className="md:text-md relative z-10 text-sm capitalize text-white dark:text-white lg:text-base">
214220
{codev.first_name} {codev.last_name}
215221
</p>
216222
{codev.display_position ? (
217-
<p className="text-sm text-gray-200 dark:text-gray-300 relative z-10">{codev.display_position}</p>
223+
<p className="relative z-10 text-sm text-gray-200 dark:text-gray-300">
224+
{codev.display_position}
225+
</p>
218226
) : (
219-
<div className="text-sm lg:text-base relative z-10">&nbsp;</div>
227+
<div className="relative z-10 text-sm lg:text-base">&nbsp;</div>
220228
)}
221229
</div>
222230
</div>

‎apps/codebility/app/home/interns/_components/CodevCard.tsx‎

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import CodevBadge from "@/components/CodevBadge";
55
import DefaultAvatar from "@/components/DefaultAvatar";
66
import Box from "@/components/shared/dashboard/Box";
77
import { useModal } from "@/hooks/use-modal-users";
8-
import { Codev, CodevPoints, ApplicantStatus } from "@/types/home/codev";
8+
import { ApplicantStatus, Codev, CodevPoints } from "@/types/home/codev";
99
import {
1010
AnimatePresence,
1111
motion,
@@ -29,23 +29,28 @@ const STATUS_CONFIG: Record<
2929
> = {
3030
applying: {
3131
label: "Applying",
32-
className: "bg-customBlue-500/20 backdrop-blur-sm text-customBlue-200 border border-customBlue-500/30 dark:bg-customBlue-500/10 dark:text-customBlue-300",
32+
className:
33+
"bg-customBlue-500/20 backdrop-blur-sm text-customBlue-200 border border-customBlue-500/30 dark:bg-customBlue-500/10 dark:text-customBlue-300",
3334
},
3435
testing: {
3536
label: "Testing",
36-
className: "bg-orange-500/20 backdrop-blur-sm text-orange-200 border border-orange-500/30 dark:bg-orange-500/10 dark:text-orange-300",
37+
className:
38+
"bg-orange-500/20 backdrop-blur-sm text-orange-200 border border-orange-500/30 dark:bg-orange-500/10 dark:text-orange-300",
3739
},
3840
onboarding: {
3941
label: "Onboarding",
40-
className: "bg-purple-500/20 backdrop-blur-sm text-purple-200 border border-purple-500/30 dark:bg-purple-500/10 dark:text-purple-300",
42+
className:
43+
"bg-purple-500/20 backdrop-blur-sm text-purple-200 border border-purple-500/30 dark:bg-purple-500/10 dark:text-purple-300",
4144
},
4245
denied: {
4346
label: "Denied",
44-
className: "bg-red-500/20 backdrop-blur-sm text-red-200 border border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
47+
className:
48+
"bg-red-500/20 backdrop-blur-sm text-red-200 border border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
4549
},
4650
passed: {
4751
label: "Passed",
48-
className: "bg-green-500/20 backdrop-blur-sm text-green-200 border border-green-500/30 dark:bg-green-500/10 dark:text-green-300",
52+
className:
53+
"bg-green-500/20 backdrop-blur-sm text-green-200 border border-green-500/30 dark:bg-green-500/10 dark:text-green-300",
4954
},
5055
};
5156

@@ -61,7 +66,7 @@ export default function CodevCard({ codev }: CodevCardProps) {
6166
const springConfig = { stiffness: 100, damping: 5 };
6267
const x = useMotionValue(0);
6368
const rotate = useSpring(
64-
useTransform(x, [-100, 100], [-45, 45]),
69+
useTransform(x, [-100, 100], [-20, 20]),
6570
springConfig,
6671
);
6772
const translateX = useSpring(
@@ -75,28 +80,28 @@ export default function CodevCard({ codev }: CodevCardProps) {
7580
};
7681

7782
const applicationStatus = codev.application_status || "applying";
78-
const statusConfig = STATUS_CONFIG[applicationStatus as ApplicantStatus] || STATUS_CONFIG.applying;
83+
const statusConfig =
84+
STATUS_CONFIG[applicationStatus as ApplicantStatus] ||
85+
STATUS_CONFIG.applying;
7986

8087
return (
8188
<div
8289
onMouseEnter={() => setHovered(true)}
8390
onMouseLeave={() => setHovered(false)}
8491
onMouseMove={handleMouseMove}
8592
>
86-
<div
87-
className="group relative h-full rounded-2xl bg-white/10 backdrop-blur-md p-4 shadow-lg transition-all duration-300 hover:bg-white/20 hover:shadow-xl dark:bg-white/5 dark:hover:bg-white/10 border border-white/20 dark:border-white/10 overflow-hidden"
88-
>
93+
<div className="group relative h-full rounded-2xl border border-white/20 bg-white/10 p-4 shadow-lg backdrop-blur-md transition-all duration-300 hover:bg-white/20 hover:shadow-xl dark:border-white/10 dark:bg-white/5 dark:hover:bg-white/10">
8994
{/* Background decoration */}
90-
<div className="absolute inset-0 bg-gradient-to-br from-customBlue-50/20 to-purple-50/20 dark:from-customBlue-950/10 dark:to-purple-950/10 opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
91-
<div className="absolute -top-4 -right-4 h-24 w-24 rounded-full bg-gradient-to-br from-yellow-400/10 to-orange-400/10 blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
95+
<div className="from-customBlue-50/20 dark:from-customBlue-950/10 absolute inset-0 bg-gradient-to-br to-purple-50/20 opacity-0 transition-opacity duration-300 group-hover:opacity-100 dark:to-purple-950/10" />
96+
<div className="absolute -right-4 -top-4 h-24 w-24 rounded-full bg-gradient-to-br from-yellow-400/10 to-orange-400/10 opacity-0 blur-xl transition-opacity duration-500 group-hover:opacity-100" />
9297
<div
9398
className="flex h-full cursor-pointer flex-col justify-start gap-4"
9499
onClick={() => onOpen("profileModal", codev)}
95100
>
96101
{/* Header Section */}
97102
<div className="relative flex items-start justify-start gap-4">
98103
<div className="relative">
99-
<div className="h-16 w-16 overflow-hidden rounded-full bg-gradient-to-br from-customBlue-100 to-purple-100 p-0.5 dark:from-customBlue-900 dark:to-purple-900">
104+
<div className="from-customBlue-100 dark:from-customBlue-900 h-16 w-16 overflow-hidden rounded-full bg-gradient-to-br to-purple-100 p-0.5 dark:to-purple-900">
100105
<div className="h-full w-full overflow-hidden rounded-full bg-white dark:bg-gray-800">
101106
{codev.image_url ? (
102107
<img
@@ -120,8 +125,8 @@ export default function CodevCard({ codev }: CodevCardProps) {
120125
scale: 1,
121126
transition: {
122127
type: "spring",
123-
stiffness: 260,
124-
damping: 10,
128+
stiffness: 120,
129+
damping: 20,
125130
},
126131
}}
127132
exit={{ opacity: 0, y: 20, scale: 0.6 }}
@@ -131,14 +136,13 @@ export default function CodevCard({ codev }: CodevCardProps) {
131136
whiteSpace: "nowrap",
132137
}}
133138
className={cn(
134-
`absolute -top-16 left-1/2 z-[100] flex -translate-x-1/2
135-
transform flex-col items-center justify-center rounded-xl px-3 py-2 shadow-xl
136-
${statusConfig?.className || ''}
139+
`right-1/8 -translate-x-1/8 absolute -top-8 z-50 flex transform flex-col items-center justify-center rounded-lg px-4 py-2 shadow-xl
140+
${statusConfig?.className || ""}
137141
`,
138142
)}
139143
>
140144
<div className="relative z-30 text-sm font-medium">
141-
{statusConfig?.label || 'Applying'}
145+
{statusConfig?.label || "Applying"}
142146
</div>
143147
</motion.div>
144148
)}
@@ -148,7 +152,9 @@ export default function CodevCard({ codev }: CodevCardProps) {
148152
<div
149153
className={cn(
150154
"h-4 w-4 rounded-full border-2 border-white dark:border-gray-800",
151-
codev.availability_status === true ? "bg-green-500" : "bg-red-500",
155+
codev.availability_status === true
156+
? "bg-green-500"
157+
: "bg-red-500",
152158
)}
153159
></div>
154160
</div>
@@ -158,14 +164,15 @@ export default function CodevCard({ codev }: CodevCardProps) {
158164
<h3 className="text-xl font-medium text-gray-900 dark:text-white">
159165
{codev.first_name} {codev.last_name}
160166
</h3>
161-
<p className="text-sm font-medium text-customBlue-300 dark:text-customBlue-100">
167+
<p className="text-customBlue-300 dark:text-customBlue-100 text-sm font-medium">
162168
{codev.display_position || "No Position"}
163169
</p>
164170
{/* Years of Experience */}
165171
{codev.years_of_experience !== undefined && (
166172
<div className="text-sm text-gray-500 dark:text-gray-400">
167173
{codev.years_of_experience}{" "}
168-
{codev.years_of_experience === 1 ? "year" : "years"} experience
174+
{codev.years_of_experience === 1 ? "year" : "years"}{" "}
175+
experience
169176
</div>
170177
)}
171178
{/* Add CodevBadge here */}
@@ -199,8 +206,8 @@ export default function CodevCard({ codev }: CodevCardProps) {
199206
<Badge
200207
variant="info"
201208
key={project.id}
202-
className="rounded-full bg-gradient-to-r from-customBlue-600 to-indigo-600 px-3 py-1 text-xs font-medium text-white transition-all duration-300
203-
hover:from-customBlue-700 hover:to-indigo-700 dark:from-customBlue-500 dark:to-indigo-500 dark:hover:from-customBlue-600 dark:hover:to-indigo-600
209+
className="from-customBlue-600 hover:from-customBlue-700 dark:from-customBlue-500 dark:hover:from-customBlue-600 rounded-full bg-gradient-to-r to-indigo-600 px-3 py-1 text-xs font-medium
210+
text-white transition-all duration-300 hover:to-indigo-700 dark:to-indigo-500 dark:hover:to-indigo-600
204211
"
205212
>
206213
{project.name}

0 commit comments

Comments
 (0)