import { forwardRef, type HTMLAttributes } from "react";
import { cn } from "~/lib/utils";

type ChatMessageListProps = HTMLAttributes<HTMLDivElement>;

const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
  ({ className, children, ...props }, ref) => (
    <div
      className={cn(
        "flex h-full w-full flex-col overflow-y-auto p-4",
        className,
      )}
      ref={ref}
      {...props}
    >
      {children}
    </div>
  ),
);

ChatMessageList.displayName = "ChatMessageList";

export { ChatMessageList };
