mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-03-01 15:16:41 +08:00

* fix(component/Lyric): 点击歌手名字跳转后不会关闭歌词面板 * fix: 移除build.sqlite3.js中的dll复制 当前使用的better-sqlite3版本已经支持仅单个node文件,不需要也不再构建dll文件 * fix: 对歌词使用更精确的key,避免多个歌词时间相同时的key相同错误 * update
49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
const ArtistInline = ({
|
|
artists,
|
|
className,
|
|
disableLink,
|
|
onClick,
|
|
}: {
|
|
artists: Artist[]
|
|
className?: string
|
|
disableLink?: boolean
|
|
onClick?: (artistId: number) => void
|
|
}) => {
|
|
if (!artists) return <div></div>
|
|
|
|
const navigate = useNavigate()
|
|
const handleClick = (id: number) => {
|
|
if (id === 0 || disableLink) return
|
|
if (!onClick) {
|
|
navigate(`/artist/${id}`)
|
|
} else {
|
|
onClick(id)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={classNames(
|
|
!className?.includes('line-clamp') && 'line-clamp-1',
|
|
className
|
|
)}
|
|
>
|
|
{artists.map((artist, index) => (
|
|
<span key={`${artist.id}-${artist.name}`}>
|
|
<span
|
|
onClick={() => handleClick(artist.id)}
|
|
className={classNames({
|
|
'hover:underline': !!artist.id && !disableLink,
|
|
})}
|
|
>
|
|
{artist.name}
|
|
</span>
|
|
{index < artists.length - 1 ? ', ' : ''}
|
|
</span>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ArtistInline
|