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