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">
<path d="M21 10H14V3" stroke="black" 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="M21 10H14V3" stroke="white" 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>

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">
<path d="M12 5H19V12" stroke="black" 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 5H19V12" stroke="white" 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>

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">
<rect x="5" y="3" width="5" height="18" rx="0.8" fill="white" fill-opacity="0.95"/>
<rect x="14" y="3" width="5" height="18" rx="0.8" fill="white" fill-opacity="0.95"/>
<svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="27" cy="27" r="27" fill="#C43737"/>
<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>

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">
<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"/>
<svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
<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>

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);
return (
// 注释为高斯模糊效果
// <div
// className={`fixed w-[100vw] h-[130px] bg-[#fff] ${className} transition-bottom duration-700 shadow-lg shadow-black-[0_0_10px] z-10`}
// style={{ bottom: positionBottom }}
// 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: 0 }}
// >
<div
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 { 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}>
{/* 播放顺序 */}
<Image
src={orders[order].icon}
width={28}
height={28}
className="ml-[55px] mr-[60px]"
alt={orders[order].label}
/>
</button>
<div className="flex items-center h-[54px]">
{/* 播放顺序 */}
<PlayerButton
size={28}
img={orders[order].icon}
text={orders[order].label}
onClick={onOrder}
className="ml-[55px] mr-[60px]"
/>
{/* 上一首 */}
<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}
/>
</button>
className="mx-[31.5px]"
/>
{/* 下一首 */}
<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>
);

@ -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 {
-webkit-appearance: none;
width: 100%;

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

Loading…
Cancel
Save