update(AudioPlayer): Update styles.

mack-mac
mackt 8 months ago
parent 0636552867
commit 4364bdf175

@ -1,4 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21 10H14V3" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M21 10H14V3" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 14H10V21" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M3 14H10V21" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

@ -1,4 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5H19V12" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M12 5H19V12" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 19H5V12" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M12 19H5V12" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

@ -1,4 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5" y="3" width="5" height="18" rx="0.8" fill="white" fill-opacity="0.95"/> <circle cx="27" cy="27" r="27" fill="#C43737"/>
<rect x="14" y="3" width="5" height="18" rx="0.8" fill="white" fill-opacity="0.95"/> <rect x="20.7" y="18.9" width="4.5" height="16.2" rx="0.736" fill="white"/>
<rect x="28.8" y="18.9" width="4.5" height="16.2" rx="0.736" fill="white"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 303 B

@ -1,3 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0103 10.2691C21.3409 11.0395 21.3409 12.9605 20.0103 13.7309L7.00207 21.262C5.66874 22.0339 4 21.0718 4 19.5311L4 4.4689C4 2.92823 5.66874 1.96611 7.00207 2.73804L20.0103 10.2691Z" fill="white" fill-opacity="0.95"/> <circle cx="27" cy="27" r="27" fill="#C43737"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0103 10.2691C21.3409 11.0395 21.3409 12.9605 20.0103 13.7309L7.00207 21.262C5.66874 22.0339 4 21.0718 4 19.5311L4 4.4689C4 2.92823 5.66874 1.96611 7.00207 2.73804L20.0103 10.2691Z" fill="white" fill-opacity="0.95" transform="translate(15, 15)"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 458 B

@ -33,9 +33,10 @@ const PlayerBar = ({ className }: { className?: string }) => {
// const [positionBottom, setPositionBottom] = useState<number>(0); // const [positionBottom, setPositionBottom] = useState<number>(0);
return ( return (
// 注释为高斯模糊效果
// <div // <div
// className={`fixed w-[100vw] h-[130px] bg-[#fff] ${className} transition-bottom duration-700 shadow-lg shadow-black-[0_0_10px] z-10`} // className={`fixed w-[100vw] h-[130px] bg-[#000] bg-opacity-50 shadow-lg shadow-black-[0_0_10px] z-10 ${className} backdrop-blur-[4px]`}
// style={{ bottom: positionBottom }} // style={{ bottom: 0 }}
// > // >
<div <div
className={`fixed w-[100vw] h-[130px] bg-[#fff] shadow-lg shadow-black-[0_0_10px] z-10 ${className}`} className={`fixed w-[100vw] h-[130px] bg-[#fff] shadow-lg shadow-black-[0_0_10px] z-10 ${className}`}

@ -0,0 +1,27 @@
// 播放器按钮
'use client';
interface Props {
size: number;
img: string;
onClick: () => void;
text: string;
className?: string;
}
export default function ControlButton({ size, img, text, onClick, className = '' }: Props) {
return (
<a
href="#"
className={`block bg-cover bg-center bg-no-repeat ${className}`}
style={{ width: `${size}px`, height: `${size}px`, backgroundImage: `url(${img})` }}
onClick={(e) => {
e.preventDefault();
onClick();
}}
>
<span className="text-0">{text}</span>
</a>
);
}

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

@ -1,3 +1,29 @@
/* 展开 */
.album_pic_overlay_expand:hover::after {
display: block;
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.3) url(/img/audio-player/expand.svg) 50% no-repeat;
background-size: 28px;
}
/* 收起 */
.album_pic_overlay_collapse:hover::after {
display: block;
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.3) url(/img/audio-player/collapse.svg) 50% no-repeat;
background-size: 28px;
}
.range-input { .range-input {
-webkit-appearance: none; -webkit-appearance: none;
width: 100%; width: 100%;

@ -38,3 +38,4 @@ export { default as CommentHeader } from './Comment/CommentHeader';
export { default as CommentForm } from './Comment/CommentForm'; export { default as CommentForm } from './Comment/CommentForm';
export { default as CommentItem } from './Comment/CommentItem'; export { default as CommentItem } from './Comment/CommentItem';
export { default as CommentList } from './Comment/CommentList'; export { default as CommentList } from './Comment/CommentList';
export { default as PlayerButton } from './AudioPlayer/PlayerButton';

Loading…
Cancel
Save