-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonCard.tsx
67 lines (61 loc) · 2.05 KB
/
PersonCard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React, { useState } from 'react';
import Link from 'next/link';
import Image from 'next/image';
interface PersonCardProps {
personId: string | undefined;
personImage: string | undefined;
personName: string | undefined;
personNick: string | undefined;
personPosition: string | undefined;
}
function PersonCard({ personId, personImage, personName, personNick, personPosition }: PersonCardProps) {
const [hoverId, setHoverId] = useState<string | undefined>('');
const handlePersonHover = () => {
setHoverId(personId);
};
const handlePersonLeave = () => {
setHoverId('');
};
return (
<div className='max-w-[140px] overflow-hidden'>
<Link
href={`/people/${personId}`}
key={personId}>
<div
className='max-w-[140px] overflow-hidden'
key={personId}
id={personId}
onMouseOver={handlePersonHover}
onMouseLeave={handlePersonLeave}
title={`${personName} (${personPosition})`}>
<div
className='circle relative overflow-hidden cursor-pointer rounded-[50%] w-[140px] h-[140px] flex justify-center items-center mt-0 mb-[7px] mx-[15px]'
id={personId}>
<div
className='relative cursor-pointer rounded-[50%] w-[135px] h-[135px] z-[1] overflow-hidden border-[2.5px] border-solid bg-cover border-white'
id={personId}>
<Image
width={135}
height={135}
src={personImage!}
alt=''
id={personId}
/>
</div>
</div>
<div
className='text-white truncate text-center text-[0.95em] font-medium cursor-pointer'
id={personId}>
{hoverId === personId ? personName : personNick}
</div>
<div
className='text-[#dcdcdc] truncate text-center h-[50px] text-[0.8em] cursor-pointer'
id={personId}>
{personPosition}
</div>
</div>
</Link>
</div>
);
}
export default PersonCard;