Files
sofa/app/(pages)/titles/[id]/_components/cast-carousel.tsx
T
jakeandClaude Opus 4.6 fc982bee1b Comprehensive Web Interface Guidelines audit: accessibility, motion, and typography
- 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>
2026-03-05 18:20:25 -05:00

95 lines
3.5 KiB
TypeScript

"use client";
import { IconUser, IconUsers } from "@tabler/icons-react";
import { WheelGesturesPlugin } from "embla-carousel-wheel-gestures";
import Image from "next/image";
import Link from "next/link";
import {
Carousel,
CarouselContent,
CarouselItem,
} from "@/components/ui/carousel";
import type { CastMember } from "@/lib/types/title";
interface CastCarouselProps {
actors: CastMember[];
titleType: "movie" | "tv";
}
export function CastCarousel({ actors, titleType }: CastCarouselProps) {
return (
<section className="space-y-4">
<div className="flex items-center gap-2">
<IconUsers aria-hidden={true} className="size-5 text-primary" />
<h2 className="font-display text-xl tracking-tight">Cast</h2>
</div>
{actors.length > 0 && (
<Carousel
opts={{
align: "start",
dragFree: true,
containScroll: "trimSnaps",
}}
plugins={[WheelGesturesPlugin({ forceWheelAxis: "x" })]}
className="-mx-4 sm:-mx-0"
>
<CarouselContent className="px-4 sm:px-0">
{actors.map((member, i) => (
<CarouselItem
key={member.id}
className="w-[100px] shrink-0 basis-auto pl-4 sm:w-[120px]"
>
<div
className="animate-stagger-item"
style={{ "--stagger-index": i } as React.CSSProperties}
>
<Link
href={`/people/${member.personId}`}
className="group flex flex-col items-center gap-2"
>
<div className="size-20 overflow-hidden rounded-full ring-1 ring-white/10 transition-all group-hover:ring-primary/25 sm:size-24">
{member.profilePath ? (
<Image
src={member.profilePath}
alt={member.name}
width={96}
height={96}
className="h-full w-full object-cover motion-safe:transition-transform motion-safe:group-hover:scale-105"
/>
) : (
<div className="flex h-full w-full items-center justify-center bg-gradient-to-br from-muted to-muted/50">
<IconUser
aria-hidden={true}
className="size-8 text-muted-foreground/50"
/>
</div>
)}
</div>
<div className="w-full text-center">
<p className="truncate text-xs font-medium">
{member.name}
</p>
{member.character && (
<p className="truncate text-[10px] text-muted-foreground">
{member.character}
</p>
)}
{titleType === "tv" && member.episodeCount && (
<p className="text-[10px] text-muted-foreground/70">
{member.episodeCount} ep
{member.episodeCount !== 1 ? "s" : ""}
</p>
)}
</div>
</Link>
</div>
</CarouselItem>
))}
</CarouselContent>
</Carousel>
)}
</section>
);
}