fix(AudioPlayer): Fix time format.

mack-mac
mackt 7 months ago
parent 6098dfb2a1
commit e452b61bd7

@ -2,7 +2,7 @@
import Image from 'next/image'; import Image from 'next/image';
import { secondToDate } from '@/utils/timeFormat'; import { secondToDate } from '@/utils/time';
import { AutoScrollContainer } from '@/components'; import { AutoScrollContainer } from '@/components';
@ -71,7 +71,7 @@ export default function AudioPlayer({
{/* time */} {/* time */}
<p className="texe-[12px] leading[16.8px]"> <p className="texe-[12px] leading[16.8px]">
<span>{`${secondToDate(trackProgress)}`}</span> <span>{`${secondToDate(trackProgress)}`}</span>
<span className="text-[rgba(0,0,0,0.4)]">{` /${secondToDate(duration)}`}</span> <span className="text-[rgba(0,0,0,0.4)]">{` /${secondToDate(duration || 0)}`}</span>
</p> </p>
</div> </div>
@ -96,7 +96,6 @@ export default function AudioPlayer({
className="flex justify-center items-center w-[54px] h-[54px] mx-[35px] rounded-[50%] bg-[rgba(180,67,67,1)] overflow-hidden" className="flex justify-center items-center w-[54px] h-[54px] mx-[35px] rounded-[50%] bg-[rgba(180,67,67,1)] overflow-hidden"
onClick={onPlay} onClick={onPlay}
> >
{/* <Image src={'/img/audio-player/play.svg'} alt="play" width={28} height={28} /> */}
<Image <Image
src={playStatus ? '/img/audio-player/pause.svg' : '/img/audio-player/play.svg'} src={playStatus ? '/img/audio-player/pause.svg' : '/img/audio-player/play.svg'}
alt="pause" alt="pause"

@ -6,7 +6,6 @@ export const secondToDate: (v: number) => string = (second) => {
const h = hourNum ? `${hourNum}:` : ''; const h = hourNum ? `${hourNum}:` : '';
const m = minuteNum ? `${unitAddZero(minuteNum)}:` : `00:`; const m = minuteNum ? `${unitAddZero(minuteNum)}:` : `00:`;
const s = unitAddZero(secondNum); const s = unitAddZero(secondNum);
return `${h}${m}${s}`; return `${h}${m}${s}`;
}; };
Loading…
Cancel
Save