void;
+ text: string;
+ className?: string;
+}
+
+export default function ControlButton({ size, img, text, onClick, className = '' }: Props) {
+ return (
+
{
+ e.preventDefault();
+ onClick();
+ }}
+ >
+ {text}
+
+ );
+}
diff --git a/src/components/AudioPlayer/PlayerControl.tsx b/src/components/AudioPlayer/PlayerControl.tsx
index 67d0837..8efddae 100644
--- a/src/components/AudioPlayer/PlayerControl.tsx
+++ b/src/components/AudioPlayer/PlayerControl.tsx
@@ -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 (
-
+
{/* 专辑封面 */}
-
+
{audio?.pic && (
)}
- {/* title & author */}
+ {/* 歌曲信息 */}
-
{audio?.title ?? ''}
+
{audio?.title ?? ''}
{audio?.artist && audio?.album && (
-
{`${audio.artist}/${audio.album}`}
+
{`${audio.artist}/${audio.album}`}
)}
- {/* progress bar */}
-
- {/* bar */}
-
+
+ {/* 进度条 */}
+
- {/* time */}
-
+ {/* 时间 */}
+
{`${secondToDate(trackProgress)}`}
- {` /${secondToDate(duration || 0)}`}
+ {` / ${secondToDate(duration || 0)}`}
{/* control */}
-
-
+
+ {/* 播放顺序 */}
+
{/* 上一首 */}
-
+
{/* 播放/暂停 */}
-
+ className="mx-[31.5px]"
+ />
{/* 下一首 */}
-
+
);
diff --git a/src/components/AudioPlayer/index.module.css b/src/components/AudioPlayer/index.module.css
index 2f30260..8bca1de 100644
--- a/src/components/AudioPlayer/index.module.css
+++ b/src/components/AudioPlayer/index.module.css
@@ -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%;
diff --git a/src/components/index.ts b/src/components/index.ts
index 2aa4083..9a25183 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -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';