Get rid of custom components folder

This commit is contained in:
Jared Palmer 2024-11-15 10:14:25 -05:00
parent c493ac342b
commit 6d16f67280
38 changed files with 34 additions and 34 deletions

View file

@ -1,31 +0,0 @@
import { useEffect, useRef, RefObject } from 'react';
export function useScrollToBottom<T extends HTMLElement>(): [
RefObject<T>,
RefObject<T>,
] {
const containerRef = useRef<T>(null);
const endRef = useRef<T>(null);
useEffect(() => {
const container = containerRef.current;
const end = endRef.current;
if (container && end) {
const observer = new MutationObserver(() => {
end.scrollIntoView({ behavior: 'instant', block: 'end' });
});
observer.observe(container, {
childList: true,
subtree: true,
attributes: true,
characterData: true,
});
return () => observer.disconnect();
}
}, []);
return [containerRef, endRef];
}