xref: /MusicFree/src/pages/searchPage/components/resultPanel/results/artistResultItem.tsx (revision 8e47be56b0121ae1a9c00382d70902276ffca225)
1import React from 'react';
2import ListItem from '@/components/base/listItem';
3import {ImgAsset} from '@/constants/assetsConst';
4import {ROUTE_PATH, useNavigate} from '@/entry/router';
5import TitleAndTag from '@/components/mediaItem/titleAndTag';
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 navigate = useNavigate();
15    return (
16        <ListItem
17            withHorizonalPadding
18            heightType="big"
19            onPress={() => {
20                navigate(ROUTE_PATH.ARTIST_DETAIL, {
21                    artistItem: artistItem,
22                    pluginHash,
23                });
24            }}>
25            <ListItem.ListItemImage
26                uri={artistItem.avatar}
27                fallbackImg={ImgAsset.albumDefault}
28            />
29            <ListItem.Content
30                description={
31                    artistItem.desc
32                        ? artistItem.desc
33                        : `${artistItem.worksNum}个作品    ${
34                              artistItem.description ?? ''
35                          }`
36                }
37                title={
38                    <TitleAndTag
39                        title={artistItem.name}
40                        tag={artistItem.platform}
41                    />
42                }
43            />
44        </ListItem>
45    );
46}
47