mirror of
https://github.com/yudejp/yude.jp.git
synced 2025-05-10 14:08:41 +00:00
Add Spotify Now Playing
This commit is contained in:
parent
8b38cf5d75
commit
f142054a7b
@ -3,6 +3,9 @@ import { faEnvelope } from '@fortawesome/free-regular-svg-icons'
|
|||||||
import { faPhone } from '@fortawesome/free-solid-svg-icons'
|
import { faPhone } from '@fortawesome/free-solid-svg-icons'
|
||||||
import { faXTwitter, faDiscord, faGithub } from '@fortawesome/free-brands-svg-icons'
|
import { faXTwitter, faDiscord, faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||||
|
|
||||||
|
import NowPlaying from "./NowPlaying"
|
||||||
|
import Logo from "./Logo"
|
||||||
|
|
||||||
export default function Card() {
|
export default function Card() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -12,26 +15,32 @@ export default function Card() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mx-2 text-left">
|
<div className="mx-2 text-left">
|
||||||
<p className="text-5xl text-white">
|
<p className="text-5xl text-white">
|
||||||
yude
|
<Logo />
|
||||||
</p>
|
</p>
|
||||||
|
<p className="text-white mt-2 -mb-1"><NowPlaying /></p>
|
||||||
<div className="text-white mt-2">
|
<div className="text-white mt-2">
|
||||||
<p className="font-mono left-0.5 relative">
|
<p className="font-mono left-0.5 relative">
|
||||||
<FontAwesomeIcon icon={faEnvelope} /> i@yude.jp
|
<FontAwesomeIcon icon={faEnvelope} className="text-gray-300" />{" "}
|
||||||
|
i@yude.jp
|
||||||
</p>
|
</p>
|
||||||
<p className="font-mono left-0.5 relative">
|
<p className="font-mono left-0.5 relative">
|
||||||
<FontAwesomeIcon icon={faPhone} /> +81 70-8909-1949
|
<FontAwesomeIcon icon={faPhone} className="text-gray-300" />{" "}
|
||||||
|
+81 70-8909-1949
|
||||||
</p>
|
</p>
|
||||||
<p className="font-mono left-0.5 relative">
|
<p className="font-mono left-0.5 relative">
|
||||||
<a href="https://x.com/yude_jp">
|
<a href="https://x.com/yude_jp">
|
||||||
<FontAwesomeIcon icon={faXTwitter} /> @yude_jp
|
<FontAwesomeIcon icon={faXTwitter} className="text-gray-300" />{" "}
|
||||||
|
@yude_jp
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p className="font-mono left-0.5 relative">
|
<p className="font-mono left-0.5 relative">
|
||||||
<FontAwesomeIcon icon={faDiscord} /> <span className="-ml-1">yude</span>
|
<FontAwesomeIcon icon={faDiscord} className="text-gray-300" />{" "}
|
||||||
|
<span className="-ml-1">yude</span>
|
||||||
</p>
|
</p>
|
||||||
<p className="font-mono left-0.5 relative">
|
<p className="font-mono left-0.5 relative">
|
||||||
<a href="https://github.com/yude">
|
<a href="https://github.com/yude">
|
||||||
<FontAwesomeIcon icon={faGithub} /> yude
|
<FontAwesomeIcon icon={faGithub} className="text-gray-300" />{" "}
|
||||||
|
yude
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
47
src/components/NowPlaying.tsx
Normal file
47
src/components/NowPlaying.tsx
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
|
import { faMusic } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
export interface NowPlaying {
|
||||||
|
album?: string
|
||||||
|
artist?: string
|
||||||
|
isPlaying: boolean
|
||||||
|
title?: string
|
||||||
|
link?: string
|
||||||
|
album_art?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default function NowPlaying() {
|
||||||
|
const [np, setNp] = useState<NowPlaying>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch(
|
||||||
|
"https://vercel-spotify-api.vercel.app/api/Spotify"
|
||||||
|
)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data) {
|
||||||
|
setNp(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{np && np.isPlaying &&
|
||||||
|
<div className="flex flex-row">
|
||||||
|
<div className="w-5 text-gray-300">
|
||||||
|
<FontAwesomeIcon icon={faMusic} />
|
||||||
|
</div>
|
||||||
|
<div className="text-left">
|
||||||
|
<span className="text-gray-300">{np.artist}</span>
|
||||||
|
<p className="text-lg">{np.title}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user