diff --git a/src/components/SpotifyPlayer.jsx b/src/components/SpotifyPlayer.jsx index 293da81..fce1960 100644 --- a/src/components/SpotifyPlayer.jsx +++ b/src/components/SpotifyPlayer.jsx @@ -85,34 +85,64 @@ function usePlayerState(path, options) { } } -function Song({artist, title, songUrl, album, albumImageUrl, isPlaying}) { +function Song({as: Component = 'div', artist, title, songUrl, album, albumImageUrl, isPlaying}) { return ( -
+ {isPlaying && } - {album}
-

- - {title} - -

-

{artist}

+ +
-
+ ) } -function SongSkeleton() { +Song.Album = function SongAlbum({album, albumImageUrl}) { return ( -
+ {album} + ) +} + +Song.Title = function SongTitle({as: Component = 'h2', title, songUrl, className}) { + return ( + + + {title} + + + ) +} + +Song.Artist = function SongArtist({as: Component = 'p', artist}) { + return ( + + {artist} + + ) +} + +Song.Skeleton = function SongSkeleton({as: Component = 'div'}) { + return ( +
@@ -120,7 +150,7 @@ function SongSkeleton() {

-
+ ) } @@ -138,7 +168,7 @@ function LastPlayed() { return ( <> {isLoading - ? + ? : song?.title && } @@ -154,7 +184,7 @@ export function SpotifyPlayer() { return (
{isLoading - ? + ? : song?.isPlaying ? :