|
|
|
@ -6,7 +6,7 @@ import { secondToDate } from '@/utils/time';
|
|
|
|
|
|
|
|
|
|
import styles from './index.module.css';
|
|
|
|
|
|
|
|
|
|
import { AutoScrollContainer } from '@/components';
|
|
|
|
|
import { AutoScrollContainer, PlayerButton } from '@/components';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
audio: SongInfo | null;
|
|
|
|
@ -48,30 +48,31 @@ export default function AudioPlayer({
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`flex flex-row w-[1200px] pt-[29px] ${className}`}>
|
|
|
|
|
<div className={`flex w-[1200px] pt-[29px] ${className}`}>
|
|
|
|
|
{/* 专辑封面 */}
|
|
|
|
|
<div className="w-[72px] h-[72px] rounded-[3px] bg-[#000]">
|
|
|
|
|
<div
|
|
|
|
|
className={`relative w-[72px] h-[72px] rounded-[3px] bg-[#000] overflow-hidden flex-shrink cursor-pointer ${styles.album_pic_overlay_expand}`}
|
|
|
|
|
>
|
|
|
|
|
{audio?.pic && (
|
|
|
|
|
<Image src={audio?.pic} alt="music" width={72} height={72} unoptimized className="w-full h-full" />
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* title & author */}
|
|
|
|
|
{/* 歌曲信息 */}
|
|
|
|
|
<div className="h-full ml-[27px] mr-[44px] py-[14px]">
|
|
|
|
|
<AutoScrollContainer key={audio?.id} auto hover width="140px" speed={50}>
|
|
|
|
|
<div className="w-auto h-auto">
|
|
|
|
|
<p className="text-[17px] leading-[23.8px] text-[rgba(0,0,0,0.95)]">{audio?.title ?? ''}</p>
|
|
|
|
|
<p className="text-[17px] leading-[24px] text-base">{audio?.title ?? ''}</p>
|
|
|
|
|
{audio?.artist && audio?.album && (
|
|
|
|
|
<p className="text-[13px] leading-[18.2px] text-[rgba(0,0,0,0.7)]">{`${audio.artist}/${audio.album}`}</p>
|
|
|
|
|
<p className="text-[13px] leading-[18px] mt-[2px] text-[rgba(0,0,0,0.7)]">{`${audio.artist}/${audio.album}`}</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</AutoScrollContainer>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* progress bar */}
|
|
|
|
|
<div className="h-full mt-[29px]">
|
|
|
|
|
{/* bar */}
|
|
|
|
|
<div className="h-full cursor-pointer w-[600px] h-[3px]">
|
|
|
|
|
<div className="h-auto mt-[12px]">
|
|
|
|
|
{/* 进度条 */}
|
|
|
|
|
<div className="h-auto cursor-pointer w-[600px]">
|
|
|
|
|
<input
|
|
|
|
|
type="range"
|
|
|
|
|
value={trackProgress}
|
|
|
|
@ -83,45 +84,41 @@ export default function AudioPlayer({
|
|
|
|
|
style={{ background: trackStyling }}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
{/* time */}
|
|
|
|
|
<p className="texe-[12px] leading[16.8px]">
|
|
|
|
|
{/* 时间 */}
|
|
|
|
|
<p className="texe-[12px] leading[17px]">
|
|
|
|
|
<span>{`${secondToDate(trackProgress)}`}</span>
|
|
|
|
|
<span className="text-[rgba(0,0,0,0.4)]">{` /${secondToDate(duration || 0)}`}</span>
|
|
|
|
|
<span className="text-[rgba(0,0,0,0.4)]">{` / ${secondToDate(duration || 0)}`}</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* control */}
|
|
|
|
|
<div className="flex flex-row items-center">
|
|
|
|
|
<button onClick={onOrder}>
|
|
|
|
|
<div className="flex items-center h-[54px]">
|
|
|
|
|
{/* 播放顺序 */}
|
|
|
|
|
<Image
|
|
|
|
|
src={orders[order].icon}
|
|
|
|
|
width={28}
|
|
|
|
|
height={28}
|
|
|
|
|
<PlayerButton
|
|
|
|
|
size={28}
|
|
|
|
|
img={orders[order].icon}
|
|
|
|
|
text={orders[order].label}
|
|
|
|
|
onClick={onOrder}
|
|
|
|
|
className="ml-[55px] mr-[60px]"
|
|
|
|
|
alt={orders[order].label}
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
{/* 上一首 */}
|
|
|
|
|
<button onClick={onPrev}>
|
|
|
|
|
<Image src={'/img/audio-player/next.svg'} alt="pre" width={28} height={28} className="rotate-180" />
|
|
|
|
|
</button>
|
|
|
|
|
<PlayerButton
|
|
|
|
|
size={28}
|
|
|
|
|
img="/img/audio-player/next.svg"
|
|
|
|
|
text="上一首"
|
|
|
|
|
onClick={onPrev}
|
|
|
|
|
className="rotate-180"
|
|
|
|
|
/>
|
|
|
|
|
{/* 播放/暂停 */}
|
|
|
|
|
<button
|
|
|
|
|
className="flex justify-center items-center w-[54px] h-[54px] mx-[35px] rounded-[50%] bg-[rgba(180,67,67,1)] overflow-hidden"
|
|
|
|
|
<PlayerButton
|
|
|
|
|
size={54}
|
|
|
|
|
img={playStatus ? '/img/audio-player/pause.svg' : '/img/audio-player/play.svg'}
|
|
|
|
|
text={playStatus ? '暂停' : '播放'}
|
|
|
|
|
onClick={onPlay}
|
|
|
|
|
>
|
|
|
|
|
<Image
|
|
|
|
|
src={playStatus ? '/img/audio-player/pause.svg' : '/img/audio-player/play.svg'}
|
|
|
|
|
alt="pause"
|
|
|
|
|
width={28}
|
|
|
|
|
height={28}
|
|
|
|
|
className="mx-[31.5px]"
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
{/* 下一首 */}
|
|
|
|
|
<button onClick={onNext}>
|
|
|
|
|
<Image src={'/img/audio-player/next.svg'} alt="next" width={28} height={28} />
|
|
|
|
|
</button>
|
|
|
|
|
<PlayerButton size={28} img="/img/audio-player/next.svg" text="下一首" onClick={onNext} />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|