mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 05:05:38 -04:00
- Add global MotionConfig reducedMotion="user" in root layout
- Add color-scheme: dark, theme-color meta, skip-to-main-content link
- Add aria-hidden={true} to ~60+ decorative icons across 33 files
- Add aria-label to all icon-only buttons (logout, star rating, play, delete, etc.)
- Replace transition-all with specific properties (11 files)
- Add motion-safe: prefix for CSS hover transforms and animate-pulse
- Add prefers-reduced-motion: reduce override in globals.css
- Add useReducedMotion guard to status-dot pulsing animation
- Fix focus-visible styles on auth form inputs (focus → focus-visible, stronger ring)
- Add text-balance to all headings (13 files)
- Replace "..." with "…" (U+2026) in all loading/placeholder text
- Add autocomplete, spellCheck, role="alert" to auth form
- Add aria-label to Switch controls and filmography select
- Fix heading hierarchy (h3 → h2 where h2 was skipped)
- Add break-words to title overview, overscroll-contain to drawer
- Add confirmation dialog for destructive library removal
- Add group-focus-within:opacity-100 for keyboard-accessible backup actions
- Add role="radio" + aria-checked to star rating buttons
- Add aria-label to carousel region, role="img" to TMDB logo SVG
- Add text-foreground to native select for dark mode consistency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
132 lines
4.0 KiB
TypeScript
132 lines
4.0 KiB
TypeScript
"use client";
|
|
|
|
import type * as React from "react";
|
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
function Drawer({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
|
|
}
|
|
|
|
function DrawerTrigger({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
|
|
}
|
|
|
|
function DrawerPortal({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
|
|
}
|
|
|
|
function DrawerClose({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
|
|
}
|
|
|
|
function DrawerOverlay({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
return (
|
|
<DrawerPrimitive.Overlay
|
|
data-slot="drawer-overlay"
|
|
className={cn(
|
|
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/80 supports-backdrop-filter:backdrop-blur-xs",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function DrawerContent({
|
|
className,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
return (
|
|
<DrawerPortal data-slot="drawer-portal">
|
|
<DrawerOverlay />
|
|
<DrawerPrimitive.Content
|
|
data-slot="drawer-content"
|
|
className={cn(
|
|
"before:bg-background before:border-border group/drawer-content fixed z-50 flex h-auto flex-col bg-transparent p-2 text-xs/relaxed overscroll-contain before:absolute before:inset-2 before:-z-10 before:rounded-xl before:border data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
className,
|
|
)}
|
|
{...props}
|
|
>
|
|
<div className="bg-muted mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
{children}
|
|
</DrawerPrimitive.Content>
|
|
</DrawerPortal>
|
|
);
|
|
}
|
|
|
|
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="drawer-header"
|
|
className={cn(
|
|
"flex flex-col gap-1 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:text-left",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="drawer-footer"
|
|
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function DrawerTitle({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
return (
|
|
<DrawerPrimitive.Title
|
|
data-slot="drawer-title"
|
|
className={cn("text-foreground text-sm font-medium", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function DrawerDescription({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
return (
|
|
<DrawerPrimitive.Description
|
|
data-slot="drawer-description"
|
|
className={cn("text-muted-foreground text-xs/relaxed", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export {
|
|
Drawer,
|
|
DrawerPortal,
|
|
DrawerOverlay,
|
|
DrawerTrigger,
|
|
DrawerClose,
|
|
DrawerContent,
|
|
DrawerHeader,
|
|
DrawerFooter,
|
|
DrawerTitle,
|
|
DrawerDescription,
|
|
};
|