xref: /MusicFree/src/pages/searchPage/components/resultPanel/results/artistResultItem.tsx (revision 2aa881935ca35b8fb1abc4206e0dc35149231456)
1import React from 'react';
2import ListItem from '@/components/base/listItem';
3import {ImgAsset} from '@/constants/assetsConst';
4import {ROUTE_PATH, useNavigate} from '@/entry/router';
5
6interface IArtistResultsProps {
7    item: IArtist.IArtistItem;
8    index: number;
9    pluginHash: string;
10}
11export default function ArtistResultItem(props: IArtistResultsProps) {
12    const {item: artistItem, pluginHash} = props;
13    const navigate = useNavigate();
14    return (
15        <ListItem
16            left={{
17                artwork: artistItem.avatar,
18                fallback: ImgAsset.albumDefault,
19            }}
20            title={artistItem.name}
21            desc={
22                artistItem.desc
23                    ? artistItem.desc
24                    : `${artistItem.worksNum}个作品    ${
25                          artistItem.description ?? ''
26                      }`
27            }
28            tag={artistItem.platform}
29            onPress={() => {
30                navigate(ROUTE_PATH.ARTIST_DETAIL, {
31                    artistItem: artistItem,
32                    pluginHash,
33                });
34            }}
35        />
36    );
37}
38