mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 05:05:38 -04:00
- Delete carousel.tsx and replace all Carousel/CarouselContent/CarouselItem usage across title rows, cast carousel, continue watching, and explore sections with ScrollArea + scrollFade horizontal scroll - Update ScrollArea to accept a `scrollFade` prop that renders a gradient edge overlay instead of the old per-site absolute div hack - Remove "use client" directive from title-row and cast-carousel now that they have no client-side hooks - Delete unused resizable.tsx; inline TypeBadge icon into TitleHero and delete the standalone type-badge.tsx file - Add TitleTheme component for per-title accent color CSS injection - Swap IconSparkles → IconThumbUp in recommendations section and grid - Simplify ambient glow to a single size (remove mobile breakpoint override)
84 lines
3.0 KiB
TypeScript
84 lines
3.0 KiB
TypeScript
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
function ScrollArea({
|
|
className,
|
|
children,
|
|
scrollFade = true,
|
|
scrollbarGutter = false,
|
|
hideScrollbar = false,
|
|
scrollRef,
|
|
contentRef,
|
|
...props
|
|
}: ScrollAreaPrimitive.Root.Props & {
|
|
/** Fade the edges of the scroll area to indicate scrollability */
|
|
scrollFade?: boolean;
|
|
/** Leave extra space for the scrollbar, instead of it covering the content */
|
|
scrollbarGutter?: boolean;
|
|
/** Completely hide scrollbars (useful for touch/gesture-only scroll areas) */
|
|
hideScrollbar?: boolean;
|
|
/** Ref for the outer viewport element */
|
|
scrollRef?: React.Ref<HTMLDivElement>;
|
|
/** Ref for the inner content element */
|
|
contentRef?: React.Ref<HTMLDivElement>;
|
|
}) {
|
|
return (
|
|
<ScrollAreaPrimitive.Root
|
|
data-slot="scroll-area"
|
|
className={cn("relative flex min-h-0 min-w-0 overflow-hidden", className)}
|
|
{...props}
|
|
>
|
|
<ScrollAreaPrimitive.Viewport
|
|
data-slot="scroll-area-viewport"
|
|
ref={scrollRef}
|
|
className={cn(
|
|
"no-scrollbar flex-1 rounded-[inherit] outline-none focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50 data-has-overflow-x:overscroll-x-contain",
|
|
scrollFade &&
|
|
"mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
|
|
scrollbarGutter &&
|
|
"data-has-overflow-y:pr-2.5 data-has-overflow-x:pb-2.5",
|
|
)}
|
|
>
|
|
<ScrollAreaPrimitive.Content
|
|
data-slot="scroll-area-content"
|
|
ref={contentRef}
|
|
>
|
|
{children}
|
|
</ScrollAreaPrimitive.Content>
|
|
</ScrollAreaPrimitive.Viewport>
|
|
{!hideScrollbar && (
|
|
<>
|
|
<ScrollBar orientation="vertical" />
|
|
<ScrollBar orientation="horizontal" />
|
|
</>
|
|
)}
|
|
<ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />
|
|
</ScrollAreaPrimitive.Root>
|
|
);
|
|
}
|
|
|
|
function ScrollBar({
|
|
className,
|
|
orientation = "vertical",
|
|
...props
|
|
}: ScrollAreaPrimitive.Scrollbar.Props) {
|
|
return (
|
|
<ScrollAreaPrimitive.Scrollbar
|
|
data-slot="scroll-area-scrollbar"
|
|
orientation={orientation}
|
|
className={cn(
|
|
"m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1 data-[orientation=vertical]:w-1 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
|
|
className,
|
|
)}
|
|
{...props}
|
|
>
|
|
<ScrollAreaPrimitive.Thumb
|
|
data-slot="scroll-area-thumb"
|
|
className="relative flex-1 rounded-full bg-black/40 dark:bg-white/40"
|
|
/>
|
|
</ScrollAreaPrimitive.Scrollbar>
|
|
);
|
|
}
|
|
|
|
export { ScrollArea, ScrollBar };
|