jackmerrill.com/.vercel/output/static/_astro/SpotifyNowPlaying.436b8fce.js

2 lines
3.1 KiB
JavaScript
Raw Normal View History

2023-10-31 16:22:25 -07:00
import{j as e}from"./jsx-runtime.391947bd.js";import{r as n}from"./index.ed373d49.js";import{s as c}from"./index.64e1f044.cbeca326.js";const o="#1DB954",x=n.forwardRef(function({title:a="Spotify",color:t="currentColor",size:l=24,...i},r){return t==="default"&&(t=o),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:t,viewBox:"0 0 24 24",ref:r,...i,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"})]})});function u(){const[s,a]=n.useState(null);return n.useEffect(()=>{fetch("/api/spotify").then(t=>t.json()).then(t=>a(t))},[]),n.useEffect(()=>{const t=setInterval(()=>{fetch("/api/spotify").then(l=>l.json()).then(l=>a(l))},1e4);return()=>clearInterval(t)},[]),e.jsxs("div",{className:"flex p-4 items-end gap-3 self-stretch border border-[#1DB954] rounded-2xl bg-gradient-to-r from-[#11652F] to-[#417152]",children:[s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative w-10 h-10 flex items-center justify-center",children:[e.jsx("img",{src:s.album.image,className:"rounded-xl w-10 h-10 absolute opacity-50"}),e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer",className:"z-50 text-white",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6 z-50",children:e.jsx("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm14.024-.983a1.125 1.125 0 010 1.966l-5.603 3.113A1.125 1.125 0 019 15.113V8.887c0-.857.921-1.4 1.671-.983l5.603 3.113z",clipRule:"evenodd"})})})]}),e.jsxs("div",{className:"flex flex-col justify-center items-start flex-1 self-stretch",children:[e.jsx("span",{className:"text-white/60 font-light text-xs truncate max-w-[250px]",title:s.artist,children:s.artist}),e.jsx("span",{className:"text-white font-normal text-base truncate max-w-[250px]",title:s.song,children:s.song})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"block w-10 h-10 rounded-xl bg-white/10 animate-pulse"}),e.jsxs("div",{className:"flex flex-col justify-center items-start flex-1 self-stretch space-y-1",children:[e.jsx("div",{className:"block h-3 w-28 bg-white/10 animate-pulse rounded-md"}),e.jsx("div",{className:"block h-5 w-36 bg-white/10 animate-pulse rounded-md"})]})]}),e.jsxs("div",{className:`flex flex-col ${s?.nowPlaying?"justify-between":""} h-full items-center`,children:[s?.nowPlaying&&e.jsx(d,{}),e.jsx(x,{className:"w-4 h-4"})]})]})}function d(){return e.jsxs("div",{className:c.nowplaying,title:"Currently Playing",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}export{u as default};