Site geneli ScrollFlow sarmalayıcısı (Lenis lerp'li kaydırma + hıza bağlı skewY) tüm sayfa katmanını her karede transform'luyor, kaydırma performansını düşürüyordu. Yerel tarayıcı kaydırmasına dönüldü; bölüm çapaları mevcut scroll-mt değerleriyle çalışmaya devam eder. lenis bağımlılığı ve data-lenis-prevent işaretleri temizlendi. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
68 lines
1.4 KiB
TypeScript
68 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { StickToBottom } from "use-stick-to-bottom"
|
|
|
|
export type ChatContainerRootProps = {
|
|
children: React.ReactNode
|
|
className?: string
|
|
} & React.HTMLAttributes<HTMLDivElement>
|
|
|
|
export type ChatContainerContentProps = {
|
|
children: React.ReactNode
|
|
className?: string
|
|
} & React.HTMLAttributes<HTMLDivElement>
|
|
|
|
export type ChatContainerScrollAnchorProps = {
|
|
className?: string
|
|
ref?: React.RefObject<HTMLDivElement>
|
|
} & React.HTMLAttributes<HTMLDivElement>
|
|
|
|
function ChatContainerRoot({
|
|
children,
|
|
className,
|
|
...props
|
|
}: ChatContainerRootProps) {
|
|
return (
|
|
<StickToBottom
|
|
className={cn("flex overflow-y-auto", className)}
|
|
resize="smooth"
|
|
initial="instant"
|
|
role="log"
|
|
{...props}
|
|
>
|
|
{children}
|
|
</StickToBottom>
|
|
)
|
|
}
|
|
|
|
function ChatContainerContent({
|
|
children,
|
|
className,
|
|
...props
|
|
}: ChatContainerContentProps) {
|
|
return (
|
|
<StickToBottom.Content
|
|
className={cn("flex w-full flex-col", className)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</StickToBottom.Content>
|
|
)
|
|
}
|
|
|
|
function ChatContainerScrollAnchor({
|
|
className,
|
|
...props
|
|
}: ChatContainerScrollAnchorProps) {
|
|
return (
|
|
<div
|
|
className={cn("h-px w-full shrink-0 scroll-mt-4", className)}
|
|
aria-hidden="true"
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { ChatContainerRoot, ChatContainerContent, ChatContainerScrollAnchor }
|