- Spotify playlist, library, album and artist browsing with in-app playback - Song, playlist and album downloads via spotdl with YouTube and Bandcamp fallbacks - Electron desktop app (castLabs Widevine) with a permanent sidebar layout - Linux and Windows packaging scripts
114 lines
2.9 KiB
TypeScript
114 lines
2.9 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import * as SheetPrimitive from "@radix-ui/react-dialog"
|
|
import { X } from "lucide-react"
|
|
import styles from "./Sheet.module.css"
|
|
|
|
const Sheet = SheetPrimitive.Root
|
|
|
|
const SheetTrigger = SheetPrimitive.Trigger
|
|
|
|
const SheetClose = SheetPrimitive.Close
|
|
|
|
const SheetPortal = SheetPrimitive.Portal
|
|
|
|
const SheetOverlay = React.forwardRef<
|
|
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
>(({ className, ...props }, ref) => (
|
|
<SheetPrimitive.Overlay
|
|
className={`${styles.overlay} ${className ?? ""}`}
|
|
{...props}
|
|
ref={ref}
|
|
/>
|
|
))
|
|
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
|
|
|
|
interface SheetContentProps
|
|
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content> {
|
|
side?: "top" | "bottom" | "left" | "right";
|
|
container?: React.ComponentPropsWithoutRef<
|
|
typeof SheetPrimitive.Portal
|
|
>["container"];
|
|
}
|
|
|
|
const SheetContent = React.forwardRef<
|
|
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
SheetContentProps
|
|
>(({ side = "right", className, children, container, ...props }, ref) => (
|
|
<SheetPortal container={container}>
|
|
<SheetOverlay />
|
|
<SheetPrimitive.Content
|
|
ref={ref}
|
|
className={`${styles.content} ${styles[side]} ${className ?? ""}`}
|
|
{...props}
|
|
>
|
|
{children}
|
|
<SheetPrimitive.Close className={styles.close}>
|
|
<X className={styles.closeIcon} />
|
|
</SheetPrimitive.Close>
|
|
</SheetPrimitive.Content>
|
|
</SheetPortal>
|
|
))
|
|
SheetContent.displayName = SheetPrimitive.Content.displayName
|
|
|
|
const SheetHeader = ({
|
|
className,
|
|
...props
|
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
<div
|
|
className={`${styles.header} ${className ?? ""}`}
|
|
{...props}
|
|
/>
|
|
)
|
|
SheetHeader.displayName = "SheetHeader"
|
|
|
|
const SheetFooter = ({
|
|
className,
|
|
...props
|
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
<div
|
|
className={`${styles.footer} ${className ?? ""}`}
|
|
{...props}
|
|
/>
|
|
)
|
|
SheetFooter.displayName = "SheetFooter"
|
|
|
|
const SheetTitle = React.forwardRef<
|
|
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
>(({ className, ...props }, ref) => (
|
|
<SheetPrimitive.Title
|
|
ref={ref}
|
|
className={`${styles.title} ${className ?? ""}`}
|
|
{...props}
|
|
/>
|
|
))
|
|
SheetTitle.displayName = SheetPrimitive.Title.displayName
|
|
|
|
const SheetDescription = React.forwardRef<
|
|
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
>(({ className, ...props }, ref) => (
|
|
<SheetPrimitive.Description
|
|
ref={ref}
|
|
className={`${styles.description} ${className ?? ""}`}
|
|
{...props}
|
|
/>
|
|
))
|
|
SheetDescription.displayName = SheetPrimitive.Description.displayName
|
|
|
|
export {
|
|
Sheet,
|
|
SheetPortal,
|
|
SheetOverlay,
|
|
SheetTrigger,
|
|
SheetClose,
|
|
SheetContent,
|
|
SheetHeader,
|
|
SheetFooter,
|
|
SheetTitle,
|
|
SheetDescription,
|
|
}
|