export default function useScroll(elementId: string) { const el = document.getElementById(elementId); const isBottom = () => { if (el) { return el.scrollHeight - el.clientHeight <= el.scrollTop + 1; } } const adjustScroll = () => { if (el) { el.scrollTo({ top: el.scrollHeight - el.clientHeight, behavior: 'smooth' }); } } if (el) el.addEventListener('adjust-scroll', adjustScroll); window.addEventListener('resize', adjustScroll); }