├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── src ├── util.js ├── index.js ├── Components │ ├── Song.js │ ├── Nav.js │ ├── Library.js │ ├── LibrarySong.js │ └── Player.js ├── reportWebVitals.js ├── styles │ ├── App.scss │ ├── _song.scss │ ├── _nav.scss │ ├── _library.scss │ └── _player.scss ├── data.js └── App.js ├── package.json └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IslamicProgrammer/Waves-music-player/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IslamicProgrammer/Waves-music-player/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IslamicProgrammer/Waves-music-player/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/util.js: -------------------------------------------------------------------------------- 1 | export const audioPlay = (isPlaying, audioRef) => { 2 | if (isPlaying) { 3 | const PlayPromise = audioRef.current.play(); 4 | if (PlayPromise !== undefined) { 5 | PlayPromise.then((audio) => { 6 | audioRef.current.play(); 7 | }); 8 | } 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | import reportWebVitals from "./reportWebVitals"; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById("root") 11 | ); 12 | 13 | reportWebVitals(); 14 | -------------------------------------------------------------------------------- /src/Components/Song.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function Song({ currentSong }) { 4 | return ( 5 |
6 | {currentSong.name} 7 |

{currentSong.name}

8 |

{currentSong.artist}

9 |
10 | ); 11 | } 12 | 13 | export default Song; 14 | -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /src/styles/App.scss: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | body { 8 | font-family: "Lato", sans-serif; 9 | } 10 | 11 | h1, 12 | h2, 13 | h3 { 14 | color: rgb(58, 52, 52); 15 | } 16 | 17 | h3, 18 | h4 { 19 | font-weight: 400; 20 | } 21 | 22 | .App { 23 | transition: all 0.5s ease; 24 | } 25 | 26 | .library-active { 27 | margin-left: 20%; 28 | } 29 | 30 | @import "./nav"; 31 | @import "./player"; 32 | @import "./song"; 33 | @import "./library"; 34 | -------------------------------------------------------------------------------- /src/Components/Nav.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; 3 | import { faMusic } from "@fortawesome/free-solid-svg-icons"; 4 | 5 | const Nav = ({ libraryStatus, setLibraryStatus }) => { 6 | return ( 7 | 14 | ); 15 | }; 16 | 17 | export default Nav; 18 | -------------------------------------------------------------------------------- /src/styles/_song.scss: -------------------------------------------------------------------------------- 1 | .song-container { 2 | min-height: 60vh; 3 | display: flex; 4 | flex-direction: column; 5 | align-items: center; 6 | justify-content: center; 7 | 8 | img { 9 | width: 20%; 10 | border-radius: 50%; 11 | } 12 | 13 | h2 { 14 | padding: 3rem 1rem 1rem 1rem; 15 | } 16 | 17 | h3 { 18 | font-size: 1rem; 19 | } 20 | } 21 | 22 | @media screen and (max-width: 768px) { 23 | .song-container { 24 | img { 25 | width: 60%; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/styles/_nav.scss: -------------------------------------------------------------------------------- 1 | nav { 2 | min-height: 10vh; 3 | display: flex; 4 | align-items: center; 5 | justify-content: space-around; 6 | 7 | button { 8 | padding: 0.7rem; 9 | background: transparent; 10 | border: none; 11 | border: 2px solid rgb(65, 65, 65); 12 | transition: all 0.5s ease; 13 | cursor: pointer; 14 | 15 | &:hover { 16 | background: rgb(65, 65, 65); 17 | color: #fff; 18 | } 19 | } 20 | } 21 | 22 | @media screen and (max-width: 768px) { 23 | nav { 24 | button { 25 | z-index: 10; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/Components/Library.js: -------------------------------------------------------------------------------- 1 | import { library } from "@fortawesome/fontawesome-svg-core"; 2 | import React from "react"; 3 | import LibrarySong from "./LibrarySong"; 4 | 5 | function Library({ 6 | songs, 7 | setCurrentSong, 8 | audioRef, 9 | isPlaying, 10 | setSongs, 11 | libraryStatus, 12 | }) { 13 | return ( 14 |
15 |

Library

16 |
17 | {songs.map((song) => ( 18 | 28 | ))} 29 |
30 |
31 | ); 32 | } 33 | 34 | export default Library; 35 | -------------------------------------------------------------------------------- /src/Components/LibrarySong.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function LibrarySong({ 4 | song, 5 | id, 6 | setCurrentSong, 7 | songs, 8 | audioRef, 9 | isPlaying, 10 | setSongs, 11 | }) { 12 | const songSelectHandler = async () => { 13 | const selected = songs.filter((state) => state.id === id); 14 | await setCurrentSong(selected[0]); 15 | const newSongs = songs.map((song) => { 16 | if (song.id === id) { 17 | return { 18 | ...song, 19 | active: true, 20 | }; 21 | } else { 22 | return { 23 | ...song, 24 | active: false, 25 | }; 26 | } 27 | }); 28 | setSongs(newSongs); 29 | if (isPlaying) audioRef.current.play(); 30 | }; 31 | return ( 32 |
36 | {song.name} 37 |
38 |

{song.name}

39 |

{song.artist}

40 |
41 |
42 | ); 43 | } 44 | 45 | export default LibrarySong; 46 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "music-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@fortawesome/fontawesome-svg-core": "^1.2.32", 7 | "@fortawesome/free-solid-svg-icons": "^5.15.1", 8 | "@fortawesome/react-fontawesome": "^0.1.14", 9 | "@testing-library/jest-dom": "^5.11.4", 10 | "@testing-library/react": "^11.1.0", 11 | "@testing-library/user-event": "^12.1.10", 12 | "node-sass": "^4.14.1", 13 | "react": "^17.0.1", 14 | "react-dom": "^17.0.1", 15 | "react-scripts": "4.0.1", 16 | "uuid": "^8.3.2", 17 | "web-vitals": "^0.2.4" 18 | }, 19 | "scripts": { 20 | "start": "react-scripts start", 21 | "build": "react-scripts build", 22 | "test": "react-scripts test", 23 | "eject": "react-scripts eject" 24 | }, 25 | "eslintConfig": { 26 | "extends": [ 27 | "react-app", 28 | "react-app/jest" 29 | ] 30 | }, 31 | "browserslist": { 32 | "production": [ 33 | ">0.2%", 34 | "not dead", 35 | "not op_mini all" 36 | ], 37 | "development": [ 38 | "last 1 chrome version", 39 | "last 1 firefox version", 40 | "last 1 safari version" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/styles/_library.scss: -------------------------------------------------------------------------------- 1 | .library { 2 | position: fixed; 3 | top: 0; 4 | left: 0; 5 | width: 20rem; 6 | height: 100%; 7 | background: #fff; 8 | box-shadow: 2px 2px 50px gray; 9 | overflow: scroll; 10 | transform: translateX(-100%); 11 | transition: all 0.5s ease; 12 | opacity: 0; 13 | 14 | .library-title { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .library-song { 20 | transition: all 0.5s ease; 21 | display: flex; 22 | align-items: center; 23 | padding: 1rem 2rem; 24 | cursor: pointer; 25 | img { 26 | width: 30%; 27 | } 28 | 29 | &:hover { 30 | background-color: rgb(222, 230, 255); 31 | } 32 | } 33 | 34 | .song-description { 35 | padding-left: 1rem; 36 | h3 { 37 | font-size: 1rem; 38 | } 39 | 40 | h4 { 41 | font-size: 0.7rem; 42 | } 43 | } 44 | 45 | * { 46 | scrollbar-width: thin; 47 | scrollbar-color: rgba(155, 155, 155, 0.5) transparent; 48 | } 49 | 50 | *::-webkit-scrollbar { 51 | width: 5px; 52 | } 53 | 54 | *::-webkit-scrollbar-track { 55 | background: transparent; 56 | } 57 | 58 | *::-webkit-scrollbar-thumb { 59 | background: rgba(155, 155, 155, 0.5); 60 | border-radius: 20px; 61 | } 62 | 63 | .selected { 64 | background: rgb(181, 196, 236); 65 | } 66 | 67 | .active-library { 68 | transform: translateX(0); 69 | opacity: 1; 70 | } 71 | 72 | @media screen and (max-width: 768px) { 73 | .library { 74 | width: 100%; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/styles/_player.scss: -------------------------------------------------------------------------------- 1 | .player { 2 | min-height: 20vh; 3 | display: flex; 4 | flex-direction: column; 5 | align-items: center; 6 | justify-content: space-between; 7 | 8 | .time-control { 9 | width: 50%; 10 | display: flex; 11 | 12 | input { 13 | padding: 1rem 0rem; 14 | width: 100%; 15 | -webkit-appearance: none; 16 | background: transparent; 17 | cursor: pointer; 18 | } 19 | 20 | p { 21 | padding: 0 1rem; 22 | } 23 | } 24 | 25 | .play-control { 26 | display: flex; 27 | align-items: center; 28 | justify-content: space-between; 29 | padding: 1rem; 30 | width: 30%; 31 | 32 | svg { 33 | cursor: pointer; 34 | } 35 | } 36 | } 37 | 38 | input[type="range"]:focus { 39 | outline: 0; 40 | } 41 | 42 | input[type="range"]::-webkit-slider-thumb { 43 | -webkit-appearance: none; 44 | width: 16px; 45 | height: 16px; 46 | } 47 | input[type="range"]::-moz-slider-thumb { 48 | -webkit-appearance: none; 49 | width: 16px; 50 | height: 16px; 51 | } 52 | 53 | .track { 54 | background: lightgreen; 55 | height: 1rem; 56 | width: 100%; 57 | display: flex; 58 | align-items: center; 59 | justify-content: center; 60 | position: relative; 61 | border-radius: 1rem; 62 | overflow: hidden; 63 | } 64 | 65 | .animated-track { 66 | position: absolute; 67 | background: rgb(204, 204, 204); 68 | width: 100%; 69 | height: 100%; 70 | top: 0; 71 | left: 0; 72 | transform: translateX(0%); 73 | pointer-events: none; 74 | } 75 | 76 | @media screen and (max-width: 768px) { 77 | .player { 78 | .time-control { 79 | width: 90%; 80 | margin: 20px 0; 81 | } 82 | 83 | .play-control { 84 | width: 60%; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 19 | 20 | 29 | React App 30 | 31 | 32 | 33 |
34 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/data.js: -------------------------------------------------------------------------------- 1 | import { v4 as uuidv4 } from "uuid"; 2 | function chillHop() { 3 | return [ 4 | { 5 | name: "Beaver Creek", 6 | cover: 7 | "https://chillhop.com/wp-content/uploads/2020/09/0255e8b8c74c90d4a27c594b3452b2daafae608d-1024x1024.jpg", 8 | artist: "Aso, Middle School, Aviino", 9 | audio: "https://mp3.chillhop.com/serve.php/?mp3=10075", 10 | color: ["#205950", "#2ab3bf"], 11 | id: uuidv4(), 12 | active: true, 13 | }, 14 | { 15 | name: "Daylight", 16 | cover: 17 | "https://chillhop.com/wp-content/uploads/2020/07/ef95e219a44869318b7806e9f0f794a1f9c451e4-1024x1024.jpg", 18 | artist: "Aiguille", 19 | audio: "https://mp3.chillhop.com/serve.php/?mp3=9272", 20 | color: ["#EF8EA9", "#ab417f"], 21 | id: uuidv4(), 22 | active: false, 23 | }, 24 | { 25 | name: "Keep Going", 26 | cover: 27 | "https://chillhop.com/wp-content/uploads/2020/07/ff35dede32321a8aa0953809812941bcf8a6bd35-1024x1024.jpg", 28 | artist: "Swørn", 29 | audio: "https://mp3.chillhop.com/serve.php/?mp3=9222", 30 | color: ["#CD607D", "#c94043"], 31 | id: uuidv4(), 32 | active: false, 33 | }, 34 | { 35 | name: "Nightfall", 36 | cover: 37 | "https://chillhop.com/wp-content/uploads/2020/07/ef95e219a44869318b7806e9f0f794a1f9c451e4-1024x1024.jpg", 38 | artist: "Aiguille", 39 | audio: "https://mp3.chillhop.com/serve.php/?mp3=9148", 40 | color: ["#EF8EA9", "#ab417f"], 41 | id: uuidv4(), 42 | active: false, 43 | }, 44 | { 45 | name: "Reflection", 46 | cover: 47 | "https://chillhop.com/wp-content/uploads/2020/07/ff35dede32321a8aa0953809812941bcf8a6bd35-1024x1024.jpg", 48 | artist: "Swørn", 49 | audio: "https://mp3.chillhop.com/serve.php/?mp3=9228", 50 | color: ["#CD607D", "#c94043"], 51 | id: uuidv4(), 52 | active: false, 53 | }, 54 | { 55 | name: "Under the City Stars", 56 | cover: 57 | "https://chillhop.com/wp-content/uploads/2020/09/0255e8b8c74c90d4a27c594b3452b2daafae608d-1024x1024.jpg", 58 | artist: "Aso, Middle School, Aviino", 59 | audio: "https://mp3.chillhop.com/serve.php/?mp3=10074", 60 | color: ["#205950", "#2ab3bf"], 61 | id: uuidv4(), 62 | active: false, 63 | }, 64 | //ADD MORE HERE 65 | ]; 66 | } 67 | 68 | export default chillHop; 69 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useRef } from "react"; 2 | import Player from "./Components/Player"; 3 | import Song from "./Components/Song"; 4 | import data from "./data"; 5 | import "./styles/App.scss"; 6 | import Library from "./Components/Library"; 7 | import Nav from "./Components/Nav"; 8 | 9 | function App() { 10 | const audioRef = useRef(null); 11 | 12 | const [songs, setSongs] = useState(data()); 13 | const [currentSong, setCurrentSong] = useState(songs[0]); 14 | const [isPlaying, setIsPlaying] = useState(false); 15 | const [songInfo, setSongInfo] = useState({ 16 | currenTime: 0, 17 | duration: 0, 18 | animationPercentage: 0, 19 | }); 20 | const [libraryStatus, setLibraryStatus] = useState(false); 21 | 22 | const timeUpdateHandler = (e) => { 23 | const current = e.target.currentTime; 24 | const duration = e.target.duration; 25 | 26 | const roundedCurrent = Math.round(current); 27 | const roundedDuration = Math.round(duration); 28 | const animation = Math.round((roundedCurrent / roundedDuration) * 100); 29 | 30 | setSongInfo({ 31 | ...songInfo, 32 | currenTime: current, 33 | duration: duration, 34 | animationPercentage: animation, 35 | }); 36 | }; 37 | 38 | const endTrackHandler = async () => { 39 | let currentIdex = songs.findIndex((song) => song.id === currentSong.id); 40 | await setCurrentSong(songs[(currentIdex + 1) % songs.length]); 41 | if (isPlaying) audioRef.current.play(); 42 | }; 43 | 44 | return ( 45 |
46 |
75 | ); 76 | } 77 | 78 | export default App; 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #LINK FOR SEE RESULT: https://relaxing-music-player.netlify.app/ 2 | 3 | # Getting Started with Create React App 4 | 5 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 6 | 7 | ## Available Scripts 8 | 9 | In the project directory, you can run: 10 | 11 | ### `yarn start` 12 | 13 | Runs the app in the development mode.\ 14 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 15 | 16 | The page will reload if you make edits.\ 17 | You will also see any lint errors in the console. 18 | 19 | ### `yarn test` 20 | 21 | Launches the test runner in the interactive watch mode.\ 22 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 23 | 24 | ### `yarn build` 25 | 26 | Builds the app for production to the `build` folder.\ 27 | It correctly bundles React in production mode and optimizes the build for the best performance. 28 | 29 | The build is minified and the filenames include the hashes.\ 30 | Your app is ready to be deployed! 31 | 32 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 33 | 34 | ### `yarn eject` 35 | 36 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 37 | 38 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 39 | 40 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 41 | 42 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 43 | 44 | ## Learn More 45 | 46 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 47 | 48 | To learn React, check out the [React documentation](https://reactjs.org/). 49 | 50 | ### Code Splitting 51 | 52 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 53 | 54 | ### Analyzing the Bundle Size 55 | 56 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 57 | 58 | ### Making a Progressive Web App 59 | 60 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 61 | 62 | ### Advanced Configuration 63 | 64 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 65 | 66 | ### Deployment 67 | 68 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 69 | 70 | ### `yarn build` fails to minify 71 | 72 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 73 | -------------------------------------------------------------------------------- /src/Components/Player.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; 3 | import { 4 | faAngleLeft, 5 | faAngleRight, 6 | faPlay, 7 | faPause, 8 | } from "@fortawesome/free-solid-svg-icons"; 9 | import { audioPlay } from "../util"; 10 | 11 | function Player({ 12 | audioRef, 13 | songInfo, 14 | setSongInfo, 15 | currentSong, 16 | isPlaying, 17 | setIsPlaying, 18 | songs, 19 | setCurrentSong, 20 | setSongs, 21 | }) { 22 | const playAudioHandler = () => { 23 | setIsPlaying(!isPlaying); 24 | if (isPlaying) { 25 | audioRef.current.pause(); 26 | } else { 27 | audioRef.current.play(); 28 | } 29 | }; 30 | 31 | const dragHandler = (e) => { 32 | audioRef.current.currentTime = e.target.value; 33 | setSongInfo({ 34 | ...songInfo, 35 | currenTime: e.target.value, 36 | }); 37 | }; 38 | 39 | const getTime = (time) => { 40 | return ( 41 | Math.floor(time / 60) + ":" + ("0" + Math.floor(time % 60)).slice(-2) 42 | ); 43 | }; 44 | 45 | const skipTrackHandler = async (direction) => { 46 | let currentIdex = songs.findIndex((song) => song.id === currentSong.id); 47 | if (direction === "skip-forward") { 48 | await setCurrentSong(songs[(currentIdex + 1) % songs.length]); 49 | } 50 | if (direction === "skip-back") { 51 | if ((currentIdex - 1) % songs.length === -1) { 52 | await setCurrentSong(songs[songs.length - 1]); 53 | if (isPlaying) audioRef.current.play(); 54 | 55 | return; 56 | } 57 | await setCurrentSong(songs[(currentIdex - 1) % songs.length]); 58 | } 59 | if (isPlaying) audioRef.current.play(); 60 | }; 61 | 62 | useEffect(() => { 63 | const newSongs = songs.map((song) => { 64 | if (song.id === currentSong.id) { 65 | return { 66 | ...song, 67 | active: true, 68 | }; 69 | } else { 70 | return { 71 | ...song, 72 | active: false, 73 | }; 74 | } 75 | }); 76 | setSongs(newSongs); 77 | }, [currentSong]); 78 | 79 | const animTrack = { 80 | transform: `translateX(${songInfo.animationPercentage}%)`, 81 | }; 82 | 83 | return ( 84 |
85 |
86 |

{songInfo.duration ? getTime(songInfo.currenTime) : "0:00"}

87 |
93 | 100 |
101 |
102 |

{getTime(songInfo.duration)}

103 |
104 |
105 | skipTrackHandler("skip-back")} 107 | size="2x" 108 | className="skip-back" 109 | icon={faAngleLeft} 110 | /> 111 | 117 | skipTrackHandler("skip-forward")} 119 | size="2x" 120 | className="skip-forward" 121 | icon={faAngleRight} 122 | /> 123 |
124 |
125 | ); 126 | } 127 | 128 | export default Player; 129 | --------------------------------------------------------------------------------