-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSongItem.tsx
68 lines (62 loc) · 1.67 KB
/
SongItem.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
68
"use client";
import Image from "next/image";
import useLoadImage from "@/hooks/useLoadImage";
import { Song } from "@/types";
import PlayButton from "./ui/PlayButton";
interface SongItemProps {
data: Song;
onClick: (id: string) => void;
}
const SongItem: React.FC<SongItemProps> = ({
data,
onClick
}) => {
const imagePath = useLoadImage(data);
return (
<div
onClick={() => onClick(data.id)}
className="
relative
group
flex
flex-col
justify-center
items-center
rounded-md
overflow-hidden
gap-x-4
bg-neutral-400/5
cursor-pointer
hover:bg-neutral-400/10
transition
p-3
"
>
<div
className="
relative
aspect-square
w-full
h-full
rounded-md
overflow-hidden
"
>
<Image
className=" object-cover"
src={imagePath || '/images/liked.png'}
alt={data.title}
fill
/>
</div>
<div className=" flex flex-col items-start w-full pt-4 gap-y-1">
<p className=" font-semibold truncate w-full">{data.title}</p>
<p className=" text-neutral-400 text-sm pb-4 truncate">{data.author}</p>
</div>
<div className=" absolute bottom-24 right-5">
<PlayButton />
</div>
</div>
);
}
export default SongItem;