-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavatar.tsx
46 lines (43 loc) · 1.07 KB
/
avatar.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
/* eslint-disable @next/next/no-img-element */
import { AvatarColorType, BodyType, EyeType } from "@/lib/enum";
import { MovingEye } from "./moving-eye";
interface AvatarProps {
bodyType: BodyType;
eyeType: EyeType;
eyeColor: AvatarColorType;
size?: number;
}
export default function Avatar({
bodyType,
eyeType,
eyeColor,
size = 175,
}: AvatarProps) {
return (
<div className="relative flex flex-col items-center justify-center ">
<img
className="object-fit"
src={`/images/${bodyType}.png`}
width={size}
height={size}
alt="Picture of the author"
/>
<div className="flex absolute top-1/3">
<MovingEye
color={eyeColor}
size={size * 0.016}
type={
eyeType === EyeType.NORMAL ? EyeType.NORMAL : EyeType.HALF_CLOSED
}
/>
<MovingEye
color={eyeColor}
size={size * 0.016}
type={
eyeType === EyeType.NORMAL ? EyeType.NORMAL : EyeType.HALF_CLOSED
}
/>
</div>
</div>
);
}