/** * Provides pagination functions to handle page loading and scrolling. * * @returns {Object} An object with a function to handle page loading and scrolling to specific sections. * @namespace */ export function usePagination() { /** * Scrolls to a specified section on the page and optionally handles URL redirection. * * If a `scrollToSection` selector is provided, the function will smooth-scroll to that section * if it exists in the DOM. If `paramInUrl` is `true`, additional URL redirection logic can be applied * (currently a placeholder for further implementation). * * @param {string} scrollToSection - The CSS selector of the section to scroll to. * @param {boolean} paramInUrl - A flag indicating whether URL redirection should be handled. * @returns {void} */ const onLoadPage = (scrollToSection: string, paramInUrl: boolean): void => { if (scrollToSection) { const sectionElement = document.querySelector(scrollToSection) if (sectionElement) { sectionElement.scrollIntoView({ behavior: 'smooth' }) } } if (paramInUrl) { // handle redirect url } } return { onLoadPage, } }