source: frontend/src/components/search/AlbumResult.tsx@ 8ccb07e

main
Last change on this file since 8ccb07e was 8ccb07e, checked in by Filip Gavrilovski <filipgavrilovski28@…>, 5 months ago

clickable items now take the user to the respective pages; added artist username and album id to dto-s

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import { useNavigate } from "react-router-dom";
2import type { Album } from "../../utils/types";
3
4interface AlbumResultProps {
5 album: Album;
6}
7
8const AlbumResult = ({ album }: AlbumResultProps) => {
9 const navigate = useNavigate();
10
11 return (
12 <div
13 onClick={() => navigate(`/collection/album/${album.id}`)}
14 className="flex items-center gap-4 p-3 rounded-lg hover:bg-white/5 cursor-pointer transition-colors group"
15 >
16 <img
17 src={album.cover || "/favicon.png"}
18 alt={album.title}
19 className="w-12 h-12 rounded object-cover"
20 onError={(e) => {
21 (e.target as HTMLImageElement).src = "/favicon.png";
22 }}
23 />
24 <div className="flex-1 min-w-0">
25 <p className="text-white font-medium truncate">{album.title}</p>
26 <p className="text-sm text-gray-400 truncate">
27 Album • {album.releasedBy} • {album.songs?.length ?? 0} songs
28 </p>
29 </div>
30 <span className="text-xs text-gray-500 uppercase tracking-wider">
31 {album.genre}
32 </span>
33 </div>
34 );
35};
36
37export default AlbumResult;
Note: See TracBrowser for help on using the repository browser.