|
|
@ -1,6 +1,6 @@
|
|
|
|
import Image from 'next/image';
|
|
|
|
import Image from 'next/image';
|
|
|
|
|
|
|
|
|
|
|
|
import { CollectButton, IconEqualizer } from '@/components';
|
|
|
|
import { CollectButton, IconEqualizer, HighlightText } from '@/components';
|
|
|
|
|
|
|
|
|
|
|
|
interface Props extends SongInfo {
|
|
|
|
interface Props extends SongInfo {
|
|
|
|
/** 播放状态 */
|
|
|
|
/** 播放状态 */
|
|
|
@ -9,36 +9,53 @@ interface Props extends SongInfo {
|
|
|
|
showCollect: boolean;
|
|
|
|
showCollect: boolean;
|
|
|
|
/** 显示均衡器效果 */
|
|
|
|
/** 显示均衡器效果 */
|
|
|
|
showEq: boolean;
|
|
|
|
showEq: boolean;
|
|
|
|
|
|
|
|
keyword: string;
|
|
|
|
onPlay: (id: string) => void;
|
|
|
|
onPlay: (id: string) => void;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default function SongCard({ playState, id, title, pic, artist, haveCollect, duration, showEq, onPlay }: Props) {
|
|
|
|
export default function SongCard({
|
|
|
|
|
|
|
|
playState,
|
|
|
|
|
|
|
|
id,
|
|
|
|
|
|
|
|
title,
|
|
|
|
|
|
|
|
pic,
|
|
|
|
|
|
|
|
artist,
|
|
|
|
|
|
|
|
album,
|
|
|
|
|
|
|
|
showCollect,
|
|
|
|
|
|
|
|
haveCollect,
|
|
|
|
|
|
|
|
duration,
|
|
|
|
|
|
|
|
showEq,
|
|
|
|
|
|
|
|
keyword,
|
|
|
|
|
|
|
|
onPlay,
|
|
|
|
|
|
|
|
}: Props) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
className="flex flex-row items-center justify-between w-full h-[72px] my-[3px] py-[12px] px-[18px] rounded-[3px] hover:bg-[#f2f3f7] group cursor-pointer"
|
|
|
|
className="flex flex-row items-center justify-between w-full h-72px my-3px py-12px px-18px rounded-3px hover:bg-#f2f3f7 group cursor-pointer"
|
|
|
|
onClick={() => onPlay(id)}
|
|
|
|
onClick={() => onPlay(id)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{/* left */}
|
|
|
|
{/* left */}
|
|
|
|
<div className="flex flex-row items-center">
|
|
|
|
<div className="flex flex-row items-center w-full">
|
|
|
|
{/* 专辑封面 */}
|
|
|
|
{/* 专辑封面 */}
|
|
|
|
<Image
|
|
|
|
<Image
|
|
|
|
width={48}
|
|
|
|
width={48}
|
|
|
|
height={48}
|
|
|
|
height={48}
|
|
|
|
src={pic}
|
|
|
|
src={pic}
|
|
|
|
alt={title}
|
|
|
|
alt={title}
|
|
|
|
className="w-[48px] h-[48px] rounded-[3px] overflow-hidden"
|
|
|
|
className="flex-shrink-0 w-48px h-48px rounded-3px overflow-hidden"
|
|
|
|
unoptimized
|
|
|
|
unoptimized
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 歌曲名称/歌手 */}
|
|
|
|
{/* 歌曲名称/歌手 */}
|
|
|
|
<div className={`flex flex-col justify-between ml-[15px]`}>
|
|
|
|
<div className={`flex flex-col justify-between ml-15px`}>
|
|
|
|
<div className={`text-[15px] leading-[21px] text-base group-hover:text-brand ${showEq && 'text-brand'}`}>
|
|
|
|
<HighlightText
|
|
|
|
{title}
|
|
|
|
text={title}
|
|
|
|
</div>
|
|
|
|
keyword={keyword}
|
|
|
|
<div
|
|
|
|
className={`w-390px text-15px leading-21px text-base group-hover:text-brand flex-grow-1 text-overflow ${showEq && 'text-brand'}`}
|
|
|
|
className={`text-[13px] leading-[18.2px] text-[rgba(0,0,0,0.7)] group-hover:text-brand ${showEq && 'text-brand'}`}
|
|
|
|
/>
|
|
|
|
>
|
|
|
|
<HighlightText
|
|
|
|
{artist}
|
|
|
|
text={`${artist}/${album}`}
|
|
|
|
</div>
|
|
|
|
keyword={keyword}
|
|
|
|
|
|
|
|
className={`w-390px text-13px leading-18.2px text-base group-hover:text-brand flex-grow-1 text-overflow ${showEq && 'text-brand'}`}
|
|
|
|
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
@ -48,17 +65,17 @@ export default function SongCard({ playState, id, title, pic, artist, haveCollec
|
|
|
|
{showEq && <IconEqualizer active={playState} />}
|
|
|
|
{showEq && <IconEqualizer active={playState} />}
|
|
|
|
|
|
|
|
|
|
|
|
{/* 音频时长 */}
|
|
|
|
{/* 音频时长 */}
|
|
|
|
<p className="ml-[30px] mr-[13px] text-[12px] leading-[16.8px] text-[rgba(0,0,0,0.4)]">{duration || '00:00'}</p>
|
|
|
|
<p className="ml-30px text-12px leading-17px text-#000/40">{duration || '00:00'}</p>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 收藏按钮单曲 */}
|
|
|
|
{/* 收藏按钮单曲 */}
|
|
|
|
{
|
|
|
|
{showCollect && (
|
|
|
|
<CollectButton
|
|
|
|
<CollectButton
|
|
|
|
id={id}
|
|
|
|
id={id}
|
|
|
|
active={haveCollect}
|
|
|
|
active={haveCollect}
|
|
|
|
collectType="0"
|
|
|
|
collectType="0"
|
|
|
|
textClassName="w-[42px] ml-[6px] mr-[24px] text-[14px] leading-[16px]"
|
|
|
|
textClassName="w-42px ml-6px ml-12px mr-24px text-14px leading-16px text-overflow"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|