Thin auto-hiding overlay scrollbars; inbox icons below search
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
89f0d22357
commit
687a880a08
|
|
@ -3,20 +3,26 @@ import * as React from "react"
|
|||
import { cn } from "@/lib/utils"
|
||||
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
|
||||
|
||||
// Как tui-scrollbar в старом UI: нативный скролл скрыт, поверх контента —
|
||||
// тонкий бегунок, который проявляется при наведении/прокрутке и гаснет.
|
||||
function ScrollArea({
|
||||
className,
|
||||
children,
|
||||
type = "hover",
|
||||
scrollHideDelay = 700,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
||||
return (
|
||||
<ScrollAreaPrimitive.Root
|
||||
data-slot="scroll-area"
|
||||
type={type}
|
||||
scrollHideDelay={scrollHideDelay}
|
||||
className={cn("relative", className)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.Viewport
|
||||
data-slot="scroll-area-viewport"
|
||||
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
||||
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 [&>div]:block!"
|
||||
>
|
||||
{children}
|
||||
</ScrollAreaPrimitive.Viewport>
|
||||
|
|
@ -36,18 +42,17 @@ function ScrollBar({
|
|||
data-slot="scroll-area-scrollbar"
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"flex touch-none p-px transition-colors select-none",
|
||||
orientation === "vertical" &&
|
||||
"h-full w-2.5 border-l border-l-transparent",
|
||||
orientation === "horizontal" &&
|
||||
"h-2.5 flex-col border-t border-t-transparent",
|
||||
"group/bar z-20 flex touch-none p-0.5 select-none",
|
||||
"data-[state=visible]:animate-in data-[state=visible]:fade-in-0 data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0",
|
||||
orientation === "vertical" && "h-full w-2 hover:w-2.5",
|
||||
orientation === "horizontal" && "h-2 flex-col hover:h-2.5",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.ScrollAreaThumb
|
||||
data-slot="scroll-area-thumb"
|
||||
className="relative flex-1 rounded-full bg-border"
|
||||
className="relative flex-1 rounded-full bg-foreground/20 transition-colors group-hover/bar:bg-foreground/35"
|
||||
/>
|
||||
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue