parent
4364bdf175
commit
2d24ab3993
After Width: | Height: | Size: 45 KiB |
@ -0,0 +1,82 @@
|
|||||||
|
import Image from 'next/image';
|
||||||
|
import { useShallow } from 'zustand/react/shallow';
|
||||||
|
|
||||||
|
import styles from './index.module.css';
|
||||||
|
|
||||||
|
import { SongCardList } from '@/components';
|
||||||
|
import useAudioStore from '@/store/audio';
|
||||||
|
|
||||||
|
interface Prop {
|
||||||
|
// onClose: () => void;
|
||||||
|
show: boolean;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function PlayerCard({ show, className }: Prop) {
|
||||||
|
const { audioId, playQueue } = useAudioStore(
|
||||||
|
useShallow((state) => {
|
||||||
|
return {
|
||||||
|
audioId: state.audioId,
|
||||||
|
playQueue: state.playQueue,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const miniClass = 'w-100vw translate-y-100vh'; // 缩小时的样式
|
||||||
|
const largeClass = 'w-[100vw] translate-y-[-130px]'; // 放大后的样式
|
||||||
|
|
||||||
|
const audioInfo = playQueue.find((item) => item.id === audioId);
|
||||||
|
|
||||||
|
console.log(audioInfo);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`fixed left-0 bottom-0 w-[100vw] h-[calc(100vh_-_230px)] pt-[68px] bg-[#fff] transition-all duration-300 ${show ? largeClass : miniClass} ${className}`}
|
||||||
|
>
|
||||||
|
<div className="flex justify-between w-[1200px] mx-auto">
|
||||||
|
{/* 单曲信息 */}
|
||||||
|
<div>
|
||||||
|
{/* 专辑封面 */}
|
||||||
|
{/* 阴影 */}
|
||||||
|
<div className="relative w-[340px] h-[246px]">
|
||||||
|
<div
|
||||||
|
className={`absolute left-0 bottom-0 w-[230px] h-[230px] rounded-[3px] bg-[rgba(0, 0, 0, 0.08)] ${styles.album_shoadow}`}
|
||||||
|
style={{
|
||||||
|
background: 'rgba(0, 0, 0, 0.08)',
|
||||||
|
boxShadow: '27px 10px 30px -12px rgba(0, 0, 0, 0.25)',
|
||||||
|
borderRadius: '3px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{audioInfo?.pic && (
|
||||||
|
<Image
|
||||||
|
width={246}
|
||||||
|
height={246}
|
||||||
|
unoptimized
|
||||||
|
src={audioInfo.pic}
|
||||||
|
alt="pic"
|
||||||
|
className="absolute left-[16px] rounded-[3px] z-3"
|
||||||
|
style={{ boxShadow: '27px 10px 30px -12px rgba(0, 0, 0, 0.25)' }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="absolute right-0 top-[13px] w-[220px] h-[220px] bg-[url(/img/audio-player/CD.png)] z-2" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 歌曲名 */}
|
||||||
|
<p className="mt-[44px] text-[20px] leading-[28px] text-base">{audioInfo?.title ?? ''}</p>
|
||||||
|
{/* 歌手/专辑 */}
|
||||||
|
{audioInfo?.artist && audioInfo?.album && (
|
||||||
|
<p className="text-[13px] leading-[18px] mt-[2px] text-[rgba(0,0,0,0.7)]">{`${audioInfo.artist}/${audioInfo.album}`}</p>
|
||||||
|
)}
|
||||||
|
{/* 歌词 */}
|
||||||
|
<div className="mt-[30px]">{audioInfo?.lrc ? <div className="mt-[30px]"></div> : <div>暂无歌词</div>}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 播放列表 */}
|
||||||
|
<div className="w-[712px]">
|
||||||
|
<button>清空列表</button>
|
||||||
|
<SongCardList className="w-full mt-11px mb-[56px] " songList={playQueue} listId="single" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in new issue