Files
otunes/apps/web/components/playback-song-meta.tsx
T

68 lines
1.6 KiB
TypeScript

import Link from "next/link"
import type { BrowseSong } from "@/convex/library"
import { cn } from "@/lib/utils"
export function PlaybackSongMeta({
song,
isCurrent = false,
inRange = false,
align = "center",
showAlbum = true,
}: {
song: BrowseSong
isCurrent?: boolean
inRange?: boolean
align?: "center" | "start"
showAlbum?: boolean
}) {
return (
<div
className={cn(
"min-w-0",
align === "center" ? "max-w-48 text-center sm:max-w-64" : "flex-1"
)}
>
<Link
href={`/album/${song.album.id}`}
className={cn(
"block truncate text-sm font-medium hover:underline",
inRange && "text-primary-foreground hover:text-primary-foreground/80",
isCurrent && !inRange && "text-primary"
)}
>
{song.title}
</Link>
<p
className={cn(
"truncate text-xs",
inRange ? "text-primary-foreground/80" : "text-muted-foreground"
)}
>
<Link
href={`/artist/${song.artist.id}`}
className={cn(
"hover:underline",
inRange
? "text-primary-foreground/80 hover:text-primary-foreground"
: "hover:text-foreground"
)}
>
{song.artist.name}
</Link>
{showAlbum ? (
<>
<span aria-hidden="true"> — </span>
<Link
href={`/album/${song.album.id}`}
className="hover:text-foreground hover:underline"
>
{song.album.title}
</Link>
</>
) : null}
</p>
</div>
)
}