From 8e257b70f7b36452a8899de31183f95c80e7f70a Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Mon, 29 Apr 2024 14:13:42 +0800 Subject: [PATCH] update(Player): styles --- src/components/AudioPlayer/Player.tsx | 14 ++++++---- src/components/AudioPlayer/widget/Order.tsx | 26 +++++++++---------- src/components/AudioPlayer/widget/Volume.tsx | 5 ++-- .../AudioPlayer/widget/VolumeBar.tsx | 24 +++++++++-------- .../AudioPlayer/widget/index.module.css | 26 ++++++++++++++----- src/components/Icon/heart.module.css | 14 +++++++--- uno.config.ts | 17 ------------ 7 files changed, 69 insertions(+), 57 deletions(-) diff --git a/src/components/AudioPlayer/Player.tsx b/src/components/AudioPlayer/Player.tsx index 9621f2b..7a7dac5 100644 --- a/src/components/AudioPlayer/Player.tsx +++ b/src/components/AudioPlayer/Player.tsx @@ -212,9 +212,9 @@ export default function AudioPlayer({ {/* 播放进度 */} -
+
{/* 播放时长 */} - + {secondToDate(trackProgress)} @@ -226,7 +226,7 @@ export default function AudioPlayer({ /> {/* 总时长 */} - + {secondToDate(duration || 0)}
@@ -238,8 +238,12 @@ export default function AudioPlayer({ {/* 收藏歌曲 */} {} {/* 播放顺序 */} - {playListInfo.type !== 'fm' && } - + +
diff --git a/src/components/AudioPlayer/widget/Order.tsx b/src/components/AudioPlayer/widget/Order.tsx index b0bd2f9..ee42348 100644 --- a/src/components/AudioPlayer/widget/Order.tsx +++ b/src/components/AudioPlayer/widget/Order.tsx @@ -24,22 +24,22 @@ export default function Order({ // )); return ( - + {orderList.find((item) => item.value === order)?.icon ?? null} ); } const ListLoop = () => ( - + ( ); const Random = () => ( - + ( ); const SingleLoop = () => ( - + setHover(true)} onMouseLeave={() => setHover(false)} > + {/* 音量条 */} - + {/* 按钮 */} {value >= 50 ? ( diff --git a/src/components/AudioPlayer/widget/VolumeBar.tsx b/src/components/AudioPlayer/widget/VolumeBar.tsx index 135ba5b..a4c4772 100644 --- a/src/components/AudioPlayer/widget/VolumeBar.tsx +++ b/src/components/AudioPlayer/widget/VolumeBar.tsx @@ -16,16 +16,18 @@ export default function Volumne({ }; return ( - handleChange(value[0])} - > - - - - - +
+ handleChange(value[0])} + > + + + + + +
); } diff --git a/src/components/AudioPlayer/widget/index.module.css b/src/components/AudioPlayer/widget/index.module.css index 6d0d7e5..28cefdc 100644 --- a/src/components/AudioPlayer/widget/index.module.css +++ b/src/components/AudioPlayer/widget/index.module.css @@ -36,6 +36,7 @@ } /* 音量条 */ +/******************************************************************************************************/ .VolumeBarRoot { display: flex; align-items: center; @@ -43,19 +44,18 @@ } .VolumeBarRoot[data-orientation='vertical'] { flex-direction: column; - width: 20px; - height: 100px; + height: 102px; border-radius: 37px; } -/* 底色 */ .VolumeBarTrack { position: relative; flex-grow: 1; background-color: rgba(0, 0, 0, 0.1); } + .VolumeBarTrack[data-orientation='vertical'] { - width: 3px; + width: 2px; } /* 激活区域 */ @@ -70,8 +70,8 @@ /* 滑块 */ .VolumeBarThumb { display: block; - width: 11px; - height: 11px; + width: 10px; + height: 10px; border-radius: 50%; background-color: #646464; outline: none; @@ -84,3 +84,17 @@ .VolumeBarRoot:hover .VolumeBarThumb { background-color: rgba(0, 0, 0, 0.95); } + +.VolumeBarContainer::before { + content: ''; + display: block; + position: absolute; + left: calc(-50% - 0.7px); + top: calc(-50% - 0.7px); + border-radius: 24px; + width: calc(200% + 1.4px); /* 考虑到阴影会占用额外空间,增加 1.4px */ + height: calc(200% + 1.4px); /* 考虑到阴影会占用额外空间,增加 1.4px */ + box-shadow: 0 0 0 0.7px #e1e1e1; /* 使用阴影模拟边框 */ + transform: scale(0.5); + pointer-events: none; /** 防止 userCard 点击事件失效 */ +} diff --git a/src/components/Icon/heart.module.css b/src/components/Icon/heart.module.css index 4f772f5..303e8e4 100644 --- a/src/components/Icon/heart.module.css +++ b/src/components/Icon/heart.module.css @@ -9,12 +9,16 @@ .color-default { --default-color: rgb(197, 197, 197); - --active-color: #c43737; + --hover-color: var(--primary-color); + --active-color: var(--primary-color); + --active-hover-color: var(--primary-color); } .color-dark { --default-color: rgba(0, 0, 0, 0.7); - --active-color: #c43737; + --hover-color: rgba(0, 0, 0, 0.95); + --active-color: var(--primary-color); + --active-hover-color: var(--primary-color); } .heart-svg { @@ -47,8 +51,12 @@ fill: var(--active-color); } +.checkbox[type='checkbox']:checked:hover + svg .heart-path { + stroke: var(--active-hover-color); +} + .checkbox[type='checkbox']:hover + svg .heart-path { - stroke: var(--active-color); + stroke: var(--hover-color); transition: stroke 0.2s ease-in-out; } diff --git a/uno.config.ts b/uno.config.ts index 0709b64..ab60f3e 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -48,22 +48,5 @@ export default defineConfig({ colors: { brand: 'var(--primary-color)', }, - extend: { - 'border-half': { - position: 'relative', - '::after': { - content: '', - display: 'block', - position: 'absolute', - left: '-50%', - top: '-50%', - width: '200%', - height: '200%', - border: '1px solid red', - transform: 'scale(0.5)', - '-webkit-transform': 'scale(0.5)', - }, - }, - }, }, });