Skip to content

Commit e9e16a3

Browse files
committed
fix: allow tooltip to display outside card boundary (hire-a-codev and intern section)
1 parent e92696e commit e9e16a3

1 file changed

Lines changed: 32 additions & 25 deletions

File tree

‎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)