├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── album.webp ├── dolby.png ├── dolby.svg ├── favicon.ico ├── frontend-first.jpg ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json ├── picture.jpg └── robots.txt ├── src ├── App.js ├── Icons.js ├── index.css └── index.js └── tailwind.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | 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. 37 | 38 | 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. 39 | 40 | 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. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | 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) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | 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) 55 | 56 | ### Making a Progressive Web App 57 | 58 | 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) 59 | 60 | ### Advanced Configuration 61 | 62 | 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) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | 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) 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ios-apple-music-clone", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.4", 7 | "@testing-library/react": "^13.1.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "date-fns": "^2.28.0", 10 | "framer-motion": "^6.3.1", 11 | "react": "^18.0.0", 12 | "react-dom": "^18.0.0", 13 | "react-scripts": "5.0.1", 14 | "web-vitals": "^2.1.4" 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "eject": "react-scripts eject" 20 | }, 21 | "eslintConfig": { 22 | "extends": [ 23 | "react-app", 24 | "react-app/jest" 25 | ] 26 | }, 27 | "browserslist": { 28 | "production": [ 29 | ">0.2%", 30 | "not dead", 31 | "not op_mini all" 32 | ], 33 | "development": [ 34 | "last 1 chrome version", 35 | "last 1 firefox version", 36 | "last 1 safari version" 37 | ] 38 | }, 39 | "devDependencies": { 40 | "autoprefixer": "^10.4.4", 41 | "postcss": "^8.4.12", 42 | "tailwindcss": "^3.0.24" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /public/album.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/album.webp -------------------------------------------------------------------------------- /public/dolby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/dolby.png -------------------------------------------------------------------------------- /public/dolby.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/favicon.ico -------------------------------------------------------------------------------- /public/frontend-first.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/frontend-first.jpg -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | 28 | iOS Apple Music Clone 29 | 30 | 31 | 32 |
33 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/logo512.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /public/picture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samselikoff/ios-apple-music-clone/bb7ed03db5a7ae90eac195b82ec8210f4213335b/public/picture.jpg -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import { 2 | animate, 3 | LayoutGroup, 4 | motion, 5 | useDragControls, 6 | useMotionTemplate, 7 | useMotionValue, 8 | useTransform, 9 | } from "framer-motion"; 10 | import { useEffect, useRef, useState } from "react"; 11 | import * as Icons from "./Icons"; 12 | 13 | const DURATION = 186; 14 | 15 | export default function App() { 16 | let [playing, setPlaying] = useState(false); 17 | let [currentTime, setCurrentTime] = useState(0); 18 | 19 | return ( 20 |
21 |
22 |
23 |
24 | 25 | 26 | 27 | 53 | 54 |
55 | 56 | 57 | <LayoutGroup> 58 | <ProgressBar 59 | playing={playing} 60 | currentTime={currentTime} 61 | setCurrentTime={setCurrentTime} 62 | /> 63 | 64 | <PlayerControls 65 | playing={playing} 66 | onPlayPause={() => setPlaying(!playing)} 67 | /> 68 | 69 | <Volume /> 70 | </LayoutGroup> 71 | 72 | <IconBar /> 73 | </div> 74 | </div> 75 | </div> 76 | 77 | <div className="pt-6 pb-6 text-xs font-medium sm:pb-0"> 78 | <a 79 | className=" text-[#273759] hover:text-[#384f80]" 80 | href="https://twitter.com/samselikoff" 81 | > 82 | @samselikoff 83 | </a> 84 | <span className="mx-2 text-[#273759]">·</span> 85 | <a 86 | href="https://github.com/samselikoff/ios-apple-music-clone" 87 | className="text-[#273759] hover:text-[#384f80]" 88 | > 89 | GitHub 90 | </a> 91 | </div> 92 | </div> 93 | ); 94 | } 95 | 96 | function Header() { 97 | return ( 98 | <div className="w-full pt-3 mb-8"> 99 | <div className="flex items-center justify-between pl-3 pr-1 "> 100 | <div className="flex items-center space-x-1.5"> 101 | <span className="font-semibold text-white text-[17px]">6:18</span> 102 | <Icons.Location className="w-[13px] text-white" /> 103 | </div> 104 | <div className="flex items-center space-x-1.5"> 105 | <Icons.Signal className="h-[18px] text-white" /> 106 | <Icons.Wifi className="h-[22px] text-white" /> 107 | <Icons.Battery className="h-[24px] text-white" /> 108 | </div> 109 | </div> 110 | <div className="mt-4 w-9 h-[5px] mx-auto rounded-full bg-white/20"></div> 111 | </div> 112 | ); 113 | } 114 | 115 | function AnimatedGradient() { 116 | let interval = useMotionValue(0); 117 | let y = useTransform(interval, (value) => Math.sin(value) * 100); 118 | let x = useTransform(interval, (value) => Math.cos(value) * 100); 119 | 120 | useEffect(() => { 121 | let controls = animate(interval, [0, Math.PI * 2], { 122 | repeat: Infinity, 123 | duration: 15, 124 | ease: "linear", 125 | }); 126 | 127 | return controls.stop; 128 | }, [interval]); 129 | 130 | return ( 131 | <div className="absolute inset-0 z-[-1] overflow-hidden sm:rounded-xl"> 132 | <motion.div 133 | style={{ 134 | x, 135 | y, 136 | scale: 1.75, 137 | backgroundColor: "#322840", 138 | backgroundImage: ` 139 | radial-gradient(at 21% 33%, #1f2460 0px, transparent 50%), 140 | radial-gradient(at 79% 32%, #2d1e51 0px, transparent 50%), 141 | radial-gradient(at 26% 83%, #0f2451 0px, transparent 50%)`, 142 | }} 143 | className="absolute inset-0" 144 | ></motion.div> 145 | </div> 146 | ); 147 | } 148 | 149 | function Title() { 150 | return ( 151 | <div className="flex items-center justify-between"> 152 | <div> 153 | <p className="text-xl font-medium leading-tight text-white truncate"> 154 | You Right 155 | </p> 156 | <p className=" text-xl leading-tight truncate text-[#A49FC3]/90"> 157 | Doja Cat & The Weeknd 158 | </p> 159 | </div> 160 | <button className="flex items-center justify-center rounded-full w-7 h-7 bg-white/10 active:bg-white/20"> 161 | <Icons.Dots className="w-4 h-4 text-white" /> 162 | </button> 163 | </div> 164 | ); 165 | } 166 | 167 | function ProgressBar({ playing, currentTime, setCurrentTime }) { 168 | let [dragging, setDragging] = useState(false); 169 | let constraintsRef = useRef(); 170 | let fullBarRef = useRef(); 171 | let scrubberRef = useRef(); 172 | let scrubberX = useMotionValue(0); 173 | let currentTimePrecise = useMotionValue(currentTime); 174 | let progressPrecise = useTransform( 175 | currentTimePrecise, 176 | (v) => (v / DURATION) * 100 177 | ); 178 | let progressPreciseWidth = useMotionTemplate`${progressPrecise}%`; 179 | let dragControls = useDragControls(); 180 | 181 | let mins = Math.floor(currentTime / 60); 182 | let secs = `${currentTime % 60}`.padStart(2, "0"); 183 | let timecode = `${mins}:${secs}`; 184 | let minsRemaining = Math.floor((DURATION - currentTime) / 60); 185 | let secsRemaining = `${(DURATION - currentTime) % 60}`.padStart(2, "0"); 186 | let timecodeRemaining = `${minsRemaining}:${secsRemaining}`; 187 | let progress = (currentTime / DURATION) * 100; 188 | 189 | useInterval( 190 | () => { 191 | if (currentTime < DURATION) { 192 | setCurrentTime((t) => t + 1); 193 | } 194 | }, 195 | playing ? 1000 : null 196 | ); 197 | 198 | useInterval( 199 | () => { 200 | if (currentTime < DURATION) { 201 | currentTimePrecise.set(currentTimePrecise.get() + 0.01); 202 | let newX = getXFromProgress({ 203 | containerRef: fullBarRef, 204 | progress: currentTimePrecise.get() / DURATION, 205 | }); 206 | scrubberX.set(newX); 207 | } 208 | }, 209 | playing ? 10 : null 210 | ); 211 | 212 | return ( 213 | <div className="relative w-full mt-[25px]"> 214 | <div 215 | className="relative" 216 | onPointerDown={(event) => { 217 | let newProgress = getProgressFromX({ 218 | containerRef: fullBarRef, 219 | x: event.clientX, 220 | }); 221 | dragControls.start(event, { snapToCursor: true }); 222 | setCurrentTime(Math.floor(newProgress * DURATION)); 223 | currentTimePrecise.set(newProgress * DURATION); 224 | }} 225 | > 226 | <div 227 | ref={fullBarRef} 228 | className="w-full h-[3px] bg-[#5A526F] rounded-full" 229 | ></div> 230 | <motion.div 231 | layout 232 | style={{ width: progressPreciseWidth }} 233 | className="absolute top-0" 234 | > 235 | <div className="absolute inset-0 h-[3px] bg-[#A29CC0] rounded-full"></div> 236 | </motion.div> 237 | <div 238 | className="absolute inset-0 -ml-[15px] -mr-[17px]" 239 | ref={constraintsRef} 240 | > 241 | <motion.button 242 | ref={scrubberRef} 243 | drag="x" 244 | dragConstraints={constraintsRef} 245 | dragControls={dragControls} 246 | dragElastic={0} 247 | dragMomentum={false} 248 | style={{ x: scrubberX }} 249 | onDrag={() => { 250 | let scrubberBounds = scrubberRef.current.getBoundingClientRect(); 251 | let middleOfScrubber = 252 | scrubberBounds.x + scrubberBounds.width / 2; 253 | let newProgress = getProgressFromX({ 254 | containerRef: fullBarRef, 255 | x: middleOfScrubber, 256 | }); 257 | setCurrentTime(Math.floor(newProgress * DURATION)); 258 | currentTimePrecise.set(newProgress * DURATION); 259 | }} 260 | onDragStart={() => { 261 | setDragging(true); 262 | }} 263 | onPointerDown={() => { 264 | setDragging(true); 265 | }} 266 | onPointerUp={() => { 267 | setDragging(false); 268 | }} 269 | onDragEnd={() => { 270 | setDragging(false); 271 | }} 272 | className="absolute flex items-center justify-center rounded-full cursor-grab active:cursor-grabbing" 273 | > 274 | <motion.div 275 | animate={{ scale: dragging ? 1 : 0.25 }} 276 | transition={{ type: "tween", duration: 0.15 }} 277 | initial={false} 278 | className="w-[33px] h-[33px] bg-[#A29CC0] rounded-full -mt-[15px]" 279 | ></motion.div> 280 | </motion.button> 281 | </div> 282 | </div> 283 | <div className="flex justify-between mt-[11px]"> 284 | <motion.p 285 | className="absolute left-0 text-[11px] font-medium tracking-wide text-white/20 tabular-nums" 286 | animate={{ y: dragging && progress < 12 ? 15 : 0 }} 287 | > 288 | {timecode} 289 | </motion.p> 290 | <img 291 | className="h-[11.5px] mt-1 mx-auto pointer-events-none" 292 | src="/dolby.svg" 293 | alt="" 294 | /> 295 | <motion.p 296 | className="absolute right-0 text-[11px] font-medium tracking-wide text-white/20 tabular-nums" 297 | animate={{ y: dragging && progress > 85 ? 15 : 0 }} 298 | > 299 | -{timecodeRemaining} 300 | </motion.p> 301 | </div> 302 | </div> 303 | ); 304 | } 305 | 306 | function PlayerControls({ playing, onPlayPause }) { 307 | return ( 308 | <div className="mt-6"> 309 | <div className="flex items-center justify-between px-4"> 310 | <Button className="w-20 h-20 p-3"> 311 | <Icons.Skip className="w-[42px] h-[42px] text-white rotate-180" /> 312 | </Button> 313 | 314 | <Button onClick={onPlayPause} className="w-20 h-20 p-3"> 315 | {playing ? ( 316 | <Icons.Pause className="w-full h-full" /> 317 | ) : ( 318 | <Icons.Play className="w-full h-full" /> 319 | )} 320 | </Button> 321 | 322 | <Button className="w-20 h-20 p-3"> 323 | <Icons.Skip className="w-[42px] h-[42px] text-white" /> 324 | </Button> 325 | </div> 326 | </div> 327 | ); 328 | } 329 | 330 | function Volume() { 331 | let dragControls = useDragControls(); 332 | let constraintsRef = useRef(); 333 | let scrubberRef = useRef(); 334 | let fullBarRef = useRef(); 335 | let volume = useMotionValue(51.5); 336 | let width = useMotionTemplate`${volume}%`; 337 | let scrubberX = useMotionValue(0); 338 | let scrubberSize = 20; 339 | 340 | useEffect(() => { 341 | let initialVolume = getXFromProgress({ 342 | containerRef: fullBarRef, 343 | progress: volume.get() / 100, 344 | }); 345 | scrubberX.set(initialVolume); 346 | }, [scrubberX, volume]); 347 | 348 | return ( 349 | <div className="flex items-center justify-between w-full mt-[38px]"> 350 | <Icons.VolumeMute className="h-5 text-[#A29CC0]" /> 351 | 352 | <div className="w-full px-[14px]"> 353 | <div 354 | data-test="slider" 355 | className="relative flex items-center flex-1 mx-3" 356 | style={{ 357 | marginLeft: -scrubberSize / 2, 358 | marginRight: -scrubberSize / 2, 359 | }} 360 | > 361 | <div 362 | data-test="slider-constraints" 363 | ref={constraintsRef} 364 | className="absolute inset-x-0 h-[3px]" 365 | ></div> 366 | 367 | <div 368 | data-test="slider-background-container" 369 | className="absolute flex items-center" 370 | style={{ left: scrubberSize / 2, right: scrubberSize / 2 }} 371 | > 372 | <div 373 | ref={fullBarRef} 374 | data-test="slider-clickable-area" 375 | className="absolute inset-x-0 flex items-center py-2 cursor-grab" 376 | onPointerDown={(event) => { 377 | let newVolume = getProgressFromX({ 378 | containerRef: fullBarRef, 379 | x: event.clientX, 380 | }); 381 | dragControls.start(event, { snapToCursor: true }); 382 | volume.set(newVolume * 100); 383 | }} 384 | > 385 | <div 386 | data-test="slider-background" 387 | className="w-full h-[3px] bg-[#5A526F] rounded-full" 388 | /> 389 | </div> 390 | 391 | <motion.div 392 | data-test="slider-current-progress" 393 | className="absolute h-[3px] rounded-full bg-[#A29CC0] pointer-events-none" 394 | style={{ width }} 395 | /> 396 | </div> 397 | 398 | <motion.button 399 | ref={scrubberRef} 400 | style={{ 401 | x: scrubberX, 402 | width: scrubberSize, 403 | height: scrubberSize, 404 | }} 405 | drag="x" 406 | dragConstraints={constraintsRef} 407 | dragControls={dragControls} 408 | dragElastic={0} 409 | dragMomentum={false} 410 | onDrag={() => { 411 | let scrubberBounds = scrubberRef.current.getBoundingClientRect(); 412 | let middleOfScrubber = 413 | scrubberBounds.x + scrubberBounds.width / 2; 414 | let newVolume = getProgressFromX({ 415 | containerRef: fullBarRef, 416 | x: middleOfScrubber, 417 | }); 418 | volume.set(newVolume * 100); 419 | }} 420 | className="bg-white rounded-full cursor-grab active:cursor-grabbing" 421 | /> 422 | </div> 423 | </div> 424 | 425 | <Icons.VolumeHigh className="h-5 text-[#A29CC0]" /> 426 | </div> 427 | ); 428 | } 429 | 430 | function IconBar() { 431 | return ( 432 | <div className="flex px-[46px] mt-6 justify-between pb-12"> 433 | <button className="text-[#A29CC0] active:text-white p-1"> 434 | <Icons.Lyrics className="h-[21px]" /> 435 | </button> 436 | <button className="text-[#A29CC0] active:text-white p-1"> 437 | <Icons.AirPlay className="h-[21px]" /> 438 | </button> 439 | <button className="text-[#A29CC0] active:text-white p-1"> 440 | <Icons.List className="h-[21px]" /> 441 | </button> 442 | </div> 443 | ); 444 | } 445 | 446 | function Button({ children, onClick = () => {}, className }) { 447 | let [pressing, setPressing] = useState(false); 448 | 449 | return ( 450 | <motion.button 451 | onTapStart={() => { 452 | setPressing(true); 453 | }} 454 | onTap={() => { 455 | setPressing(false); 456 | onClick(); 457 | }} 458 | initial={false} 459 | animate={pressing ? "pressed" : "unpressed"} 460 | variants={{ 461 | pressed: { 462 | scale: 0.85, 463 | backgroundColor: "rgba(229 231 235 .25)", 464 | opacity: 0.7, 465 | }, 466 | unpressed: { 467 | scale: [null, 0.85, 1], 468 | opacity: 1, 469 | backgroundColor: [ 470 | null, 471 | "rgba(229 231 235 .25)", 472 | "rgba(229 231 235 0)", 473 | ], 474 | }, 475 | }} 476 | transition={{ 477 | type: "spring", 478 | duration: 0.3, 479 | bounce: 0.5, 480 | }} 481 | className={`flex items-center justify-center relative text-white rounded-full ${className}`} 482 | > 483 | {children} 484 | </motion.button> 485 | ); 486 | } 487 | 488 | function getProgressFromX({ x, containerRef }) { 489 | let bounds = containerRef.current.getBoundingClientRect(); 490 | let progress = (x - bounds.x) / bounds.width; 491 | 492 | return clamp(progress, 0, 1); 493 | } 494 | 495 | function getXFromProgress({ progress, containerRef }) { 496 | let bounds = containerRef.current.getBoundingClientRect(); 497 | 498 | return progress * bounds.width; 499 | } 500 | 501 | function clamp(number, min, max) { 502 | return Math.max(min, Math.min(number, max)); 503 | } 504 | 505 | function useInterval(callback, delay) { 506 | const intervalRef = useRef(null); 507 | const savedCallback = useRef(callback); 508 | useEffect(() => { 509 | savedCallback.current = callback; 510 | }, [callback]); 511 | useEffect(() => { 512 | const tick = () => savedCallback.current(); 513 | if (typeof delay === "number") { 514 | intervalRef.current = window.setInterval(tick, delay); 515 | return () => window.clearInterval(intervalRef.current); 516 | } 517 | }, [delay]); 518 | return intervalRef; 519 | } 520 | -------------------------------------------------------------------------------- /src/Icons.js: -------------------------------------------------------------------------------- 1 | export function Play(props) { 2 | return ( 3 | <svg viewBox="0 0 40 40" fill="none" {...props}> 4 | <path 5 | d="M32.997 18.268c1.334.77 1.334 2.695 0 3.464L13 33.27c-1.333.769-2.999-.194-2.999-1.733V8.463c0-1.54 1.666-2.502 3-1.733l19.997 11.538z" 6 | fill="currentColor" 7 | /> 8 | </svg> 9 | ); 10 | } 11 | 12 | export function Pause(props) { 13 | return ( 14 | <svg 15 | viewBox="0 0 40 40" 16 | fill="none" 17 | xmlns="http://www.w3.org/2000/svg" 18 | {...props} 19 | > 20 | <rect 21 | x={21.8426} 22 | y={6} 23 | width={8.2963} 24 | height={28} 25 | rx={2.07407} 26 | fill="currentColor" 27 | /> 28 | <rect 29 | x={9.65741} 30 | y={6} 31 | width={8.2963} 32 | height={28} 33 | rx={2.07407} 34 | fill="currentColor" 35 | /> 36 | </svg> 37 | ); 38 | } 39 | 40 | export function Skip(props) { 41 | return ( 42 | <svg viewBox="0 0 48 28" fill="none" {...props}> 43 | <g> 44 | <path 45 | d="M22.997 12.268c1.334.77 1.334 2.695 0 3.464L3 27.27C1.666 28.039 0 27.076 0 25.537V2.463C0 .923 1.666-.04 3 .73l19.997 11.538z" 46 | fill="currentColor" 47 | /> 48 | <path 49 | d="M46.997 12.268c1.334.77 1.334 2.695 0 3.464L27 27.27c-1.333.769-2.999-.194-2.999-1.733V2.463C24 .923 25.666-.04 27 .73l19.997 11.538z" 50 | fill="currentColor" 51 | /> 52 | </g> 53 | </svg> 54 | ); 55 | } 56 | 57 | export function VolumeHigh(props) { 58 | return ( 59 | <svg viewBox="0 0 58 58" fill="none" {...props}> 60 | <path 61 | d="M24.4 16.482a1.754 1.754 0 00-.78-.18c-.409 0-.805.135-1.134.396L15.1 22.656H9.12c-.998 0-1.813.816-1.813 1.813v9.062c0 .997.815 1.813 1.812 1.813H15.1l7.386 5.947c.329.26.737.397 1.133.397.26 0 .533-.057.782-.182a1.812 1.812 0 001.03-1.631v-21.75c0-.702-.396-1.337-1.03-1.643zM50.694 29c0-6.718-2.628-13.005-7.408-17.729a1.36 1.36 0 00-1.926.012 1.36 1.36 0 00.011 1.926c4.26 4.202 6.593 9.81 6.593 15.791s-2.345 11.589-6.593 15.791a1.36 1.36 0 00-.011 1.926c.26.272.612.408.963.408.34 0 .69-.136.951-.397 4.792-4.712 7.42-11.01 7.42-17.728z" 62 | fill="currentColor" 63 | /> 64 | <path 65 | d="M43.602 29c0-4.928-1.88-9.55-5.302-13.016a1.36 1.36 0 00-1.925-.011 1.36 1.36 0 00-.012 1.925c2.912 2.957 4.52 6.9 4.52 11.113 0 4.214-1.608 8.157-4.52 11.113a1.36 1.36 0 00.012 1.926c.26.26.611.397.951.397.351 0 .703-.136.963-.408 3.421-3.49 5.313-8.111 5.313-13.039z" 66 | fill="currentColor" 67 | /> 68 | <path 69 | d="M32.568 20.674a1.36 1.36 0 00-1.925-.011 1.36 1.36 0 00-.012 1.925c1.677 1.7 2.606 3.976 2.606 6.412a9.105 9.105 0 01-2.606 6.412 1.36 1.36 0 00.012 1.925c.26.261.611.397.951.397.351 0 .703-.136.963-.408 2.186-2.22 3.387-5.166 3.387-8.315.011-3.16-1.19-6.117-3.376-8.337z" 70 | fill="currentColor" 71 | /> 72 | </svg> 73 | ); 74 | } 75 | 76 | export function VolumeMute(props) { 77 | return ( 78 | <svg viewBox="0 0 33 58" xmlns="http://www.w3.org/2000/svg" {...props}> 79 | <path 80 | d="M24.4 16.482a1.754 1.754 0 00-.78-.18c-.409 0-.805.135-1.134.396L15.1 22.656H9.12c-.998 0-1.813.816-1.813 1.813v9.062c0 .997.815 1.813 1.812 1.813H15.1l7.386 5.947c.329.26.737.397 1.133.397.26 0 .533-.057.782-.182a1.812 1.812 0 001.03-1.631v-21.75c0-.702-.396-1.337-1.03-1.643z" 81 | fill="currentColor" 82 | /> 83 | </svg> 84 | ); 85 | } 86 | 87 | export function Dots(props) { 88 | return ( 89 | <svg 90 | viewBox="0 0 48 48" 91 | fill="currentColor" 92 | xmlns="http://www.w3.org/2000/svg" 93 | {...props} 94 | > 95 | <circle cx={5} cy={24} r={5} /> 96 | <circle cx={24} cy={24} r={5} /> 97 | <circle cx={43} cy={24} r={5} /> 98 | </svg> 99 | ); 100 | } 101 | 102 | export function Lyrics(props) { 103 | return ( 104 | <svg 105 | viewBox="0 0 48 48" 106 | fill="currentColor" 107 | xmlns="http://www.w3.org/2000/svg" 108 | {...props} 109 | > 110 | <path 111 | fillRule="evenodd" 112 | clipRule="evenodd" 113 | d="M0 30.31V8.841A8.842 8.842 0 018.842 0h30.316A8.842 8.842 0 0148 8.842v21.466a8.842 8.842 0 01-8.842 8.842h-13.38l-8.122 7.123c-2.449 2.149-6.288.41-6.288-2.848v-4.273H8.842A8.842 8.842 0 010 30.309zM8.842 5.052h30.316a3.79 3.79 0 013.79 3.79v21.474a3.79 3.79 0 01-3.79 3.79H25.629c-1.2 0-2.374.429-3.296 1.225l-5.494 4.73a.253.253 0 01-.418-.192v-4.502c0-.694-.556-1.263-1.263-1.263H8.842a3.79 3.79 0 01-3.79-3.79V8.843a3.79 3.79 0 013.79-3.79zm6.316 19.803a.93.93 0 00.935.922c3.903 0 6.644-2.994 6.644-6.897 0-1.592-.505-2.69-.809-3.209-.795-1.351-2.147-2.526-3.802-2.526-2.387 0-4.13 1.933-4.13 4.308a4.315 4.315 0 004.307 4.32c.77 0 1.478-.215 2.11-.569-.897 1.617-2.35 2.729-4.32 2.729a.922.922 0 00-.935.922zm11.368 0a.93.93 0 00.935.922c3.903 0 6.644-2.994 6.644-6.897 0-1.592-.505-2.69-.808-3.209-.796-1.351-2.147-2.526-3.802-2.526-2.388 0-4.13 1.933-4.13 4.308a4.315 4.315 0 004.307 4.32c.77 0 1.477-.215 2.109-.569-.897 1.617-2.35 2.729-4.32 2.729a.922.922 0 00-.935.922z" 114 | /> 115 | </svg> 116 | ); 117 | } 118 | 119 | export function AirPlay(props) { 120 | return ( 121 | <svg 122 | viewBox="0 0 59 59" 123 | fill="currentColor" 124 | xmlns="http://www.w3.org/2000/svg" 125 | {...props} 126 | > 127 | <path d="M10.498 51.099l1.3-1.5c.3-.3.3-.8 0-1.1-10.5-9.7-11.2-26.2-1.4-36.7 9.8-10.5 26.2-11.2 36.7-1.4 10.5 9.8 11.2 26.2 1.4 36.7-.5.5-.9 1-1.4 1.4-.3.3-.3.8 0 1.1l1.3 1.5c.3.3.8.3 1.1.1 12-11.1 12.7-29.7 1.7-41.7-11.1-12-29.7-12.7-41.7-1.7-12 11-12.7 29.7-1.7 41.7.5.6 1.1 1.1 1.7 1.7.3.2.7.2 1-.1z" /> 128 | <path d="M11.798 29.498c0-9.7 7.9-17.6 17.6-17.6 9.7 0 17.6 8 17.6 17.7 0 4.8-2 9.5-5.5 12.8-.3.3-.3.8 0 1.1l1.3 1.5c.3.3.8.4 1.1.1 8.5-8 8.9-21.3 1-29.8s-21.3-8.9-29.8-1-9 21.2-1.1 29.7c.3.3.6.7 1 1 .3.3.8.3 1.1 0l1.3-1.5c.3-.3.3-.8 0-1.1-3.5-3.3-5.6-8-5.6-12.9z" /> 129 | <path d="M20.198 29.498c0-5.1 4.1-9.2 9.2-9.2s9.2 4.1 9.2 9.2c0 2.5-1 4.8-2.8 6.6-.3.3-.3.8 0 1.1l1.3 1.5c.3.3.8.3 1.1 0 5-4.9 5.2-12.9.3-18s-12.9-5.2-18-.3-5.2 12.9-.3 18l.3.3c.3.3.8.3 1.1 0l1.3-1.5c.3-.3.3-.8 0-1.1-1.7-1.7-2.7-4.1-2.7-6.6z" /> 130 | <path d="M47.898 56.098l-17.4-19.8c-.5-.6-1.3-.6-1.9-.1l-.1.1-17.6 19.8c-.4.5-.4 1.2.1 1.7.2.2.5.3.7.3h35.3c.6 0 1.2-.5 1.2-1.2 0-.3-.1-.6-.3-.8z" /> 131 | </svg> 132 | ); 133 | } 134 | 135 | export function List(props) { 136 | return ( 137 | <svg viewBox="0 0 66 66" fill="currentColor" {...props}> 138 | <circle cx={6.5} cy={15.5} r={4.5} /> 139 | <rect x={17} y={12} width={47} height={7} rx={3.5} /> 140 | <circle cx={6.5} cy={33.5} r={4.5} /> 141 | <rect x={17} y={30} width={47} height={7} rx={3.5} /> 142 | <circle cx={6.5} cy={51.5} r={4.5} /> 143 | <rect x={17} y={48} width={47} height={7} rx={3.5} /> 144 | </svg> 145 | ); 146 | } 147 | 148 | export function Location(props) { 149 | return ( 150 | <svg viewBox="0 0 40 40" fill="currentColor" {...props}> 151 | <path 152 | fillRule="evenodd" 153 | clipRule="evenodd" 154 | d="M33.126 1.46c2.914-1.397 7.003.564 5.73 3.535L24.323 37.57c-1.499 3.499-6.717 2.428-6.717-1.379V22.563H3.505c-3.725 0-4.872-5.045-1.513-6.656L33.126 1.46zm-.439 5.234L9.103 17.564h10.003C22 17.563 22 17.5 22 17.5V31L32.687 6.694z" 155 | /> 156 | </svg> 157 | ); 158 | } 159 | 160 | export function Signal(props) { 161 | return ( 162 | <svg viewBox="0 0 58 58" fill="currentColor" {...props}> 163 | <rect y={34} width={10} height={14} rx={2} /> 164 | <rect x={16} y={27} width={10} height={21} rx={2} /> 165 | <rect x={32} y={19} width={10} height={29} rx={2} /> 166 | <rect x={48} y={11} width={10} height={37} rx={2} opacity="0.2" /> 167 | </svg> 168 | ); 169 | } 170 | 171 | export function Wifi(props) { 172 | return ( 173 | <svg viewBox="0 0 28 28" fill="currentColor" {...props}> 174 | <path d="M5.106 12.556c.184.202.474.193.667-.018 2.171-2.294 5.028-3.507 8.218-3.507 3.217 0 6.082 1.213 8.244 3.525a.444.444 0 00.65-.018l1.231-1.24c.176-.175.176-.403.035-.57-2.118-2.61-6.064-4.483-10.16-4.483-4.087 0-8.042 1.863-10.151 4.482-.14.168-.14.396.026.572l1.24 1.257zm3.673 3.656c.211.202.493.184.695-.035 1.072-1.17 2.786-1.995 4.526-1.987 1.75-.008 3.463.835 4.562 2.013.184.211.448.202.65 0l1.38-1.353c.167-.159.184-.378.035-.554-1.371-1.661-3.876-2.856-6.627-2.856-2.76 0-5.265 1.195-6.636 2.856-.15.176-.132.387.035.554l1.38 1.362zM14 21.082c.211 0 .396-.098.756-.44l2.153-2.075a.422.422 0 00.053-.57c-.615-.783-1.732-1.416-2.962-1.416-1.266 0-2.4.66-3.006 1.485-.105.159-.053.352.097.501l2.153 2.075c.352.334.545.44.756.44z" /> 175 | </svg> 176 | ); 177 | } 178 | 179 | export function Battery(props) { 180 | return ( 181 | <svg viewBox="0 0 28 28" fill="currentColor" {...props}> 182 | <path 183 | d="M5.76 20.174h14.193c1.647 0 2.942-.18 3.874-1.113.923-.932 1.095-2.209 1.095-3.856V12.48c0-1.656-.172-2.933-1.095-3.856-.941-.932-2.227-1.113-3.874-1.113H5.733c-1.62 0-2.915.18-3.839 1.113C.962 9.556.79 10.833.79 12.454v2.75c0 1.648.172 2.934 1.095 3.857.942.932 2.227 1.113 3.875 1.113zM5.506 18.4c-.932 0-1.81-.136-2.317-.633-.507-.507-.625-1.367-.625-2.309v-3.213c0-.95.118-1.82.616-2.326.507-.507 1.394-.634 2.344-.634h14.682c.942 0 1.82.127 2.318.634.506.506.624 1.366.624 2.308v3.231c0 .942-.117 1.802-.624 2.309-.498.506-1.376.633-2.318.633h-14.7zm20.738-2.109c.751-.045 1.756-1.005 1.756-2.453 0-1.44-1.005-2.408-1.756-2.453v4.906z" 184 | opacity="0.35" 185 | /> 186 | <path d="M18.28 18H5.34c-.67 0-1.07-.097-1.351-.378-.27-.281-.68-.67-.68-1.34v-4.703c0-.681.41-1.092.68-1.373.281-.27.681-.368 1.373-.368H18.28c.67 0 1.07.098 1.351.379.27.27.378.67.378 1.34v4.724c0 .66-.108 1.06-.378 1.34-.281.282-.681.379-1.351.379z" /> 187 | </svg> 188 | ); 189 | } 190 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | button { 6 | -webkit-tap-highlight-color: transparent; 7 | } 8 | button:focus { 9 | outline: none; 10 | } 11 | 12 | .mesh { 13 | background-color: #322840; 14 | 15 | background-image: radial-gradient(at 21% 33%, #211a37 0px, transparent 50%), 16 | radial-gradient(at 79% 32%, #252844 0px, transparent 50%), 17 | radial-gradient(at 26% 83%, #1c2e54 0px, transparent 50%); 18 | 19 | /* ryan original colors */ 20 | /* background-image: radial-gradient( 21 | at 21% 33%, 22 | hsla(242, 45%, 10%, 1) 0px, 23 | transparent 50% 24 | ), 25 | radial-gradient(at 79% 32%, hsla(231, 54%, 23%, 1) 0px, transparent 50%), 26 | radial-gradient(at 26% 83%, hsla(232, 45%, 36%, 1) 0px, transparent 50%); */ 27 | 28 | /* debug colors */ 29 | /* background-image: radial-gradient(at 21% 33%, blue 0px, transparent 50%), 30 | radial-gradient(at 79% 42%, red 0px, transparent 50%), 31 | radial-gradient(at 26% 83%, green 0px, transparent 50%); */ 32 | 33 | /* animation: gradient 3s linear infinite; */ 34 | /* animation: rotate 3s linear infinite; */ 35 | } 36 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App"; 4 | import "./index.css"; 5 | 6 | const root = ReactDOM.createRoot(document.getElementById("root")); 7 | 8 | root.render( 9 | <React.StrictMode> 10 | <App /> 11 | </React.StrictMode> 12 | ); 13 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"], 3 | theme: { 4 | extend: {}, 5 | }, 6 | plugins: [], 7 | }; 8 | --------------------------------------------------------------------------------