mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-12 05:28:51 +01:00
- Updated ScrollToBottom component to use forwardRef, allowing it to accept a ref for better integration with parent components. - Modified MessagesView to utilize the new ref for the ScrollToBottom button, improving scrolling behavior and performance.
30 lines
861 B
TypeScript
30 lines
861 B
TypeScript
import { forwardRef } from 'react';
|
|
|
|
type Props = {
|
|
scrollHandler: React.MouseEventHandler<HTMLButtonElement>;
|
|
};
|
|
|
|
const ScrollToBottom = forwardRef<HTMLButtonElement, Props>(({ scrollHandler }, ref) => {
|
|
return (
|
|
<button
|
|
ref={ref}
|
|
onClick={scrollHandler}
|
|
className="premium-scroll-button absolute bottom-5 right-1/2 cursor-pointer border border-border-light bg-surface-secondary"
|
|
aria-label="Scroll to bottom"
|
|
>
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" className="text-text-secondary">
|
|
<path
|
|
d="M17 13L12 18L7 13M12 6L12 17"
|
|
stroke="currentColor"
|
|
strokeWidth="2"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
></path>
|
|
</svg>
|
|
</button>
|
|
);
|
|
});
|
|
|
|
ScrollToBottom.displayName = 'ScrollToBottom';
|
|
|
|
export default ScrollToBottom;
|