ironie-nextjs/src/app/components/PrelineScript.tsx
2025-05-28 00:41:23 +02:00

34 lines
639 B
TypeScript

'use client';
import { usePathname } from 'next/navigation';
import { useEffect } from 'react';
// Preline UI
async function loadPreline() {
return import('preline/dist/index.js');
}
export default function PrelineScript() {
const path = usePathname();
useEffect(() => {
const initPreline = async () => {
await loadPreline();
};
initPreline();
}, []);
useEffect(() => {
setTimeout(() => {
if (
window.HSStaticMethods &&
typeof window.HSStaticMethods.autoInit === 'function'
) {
window.HSStaticMethods.autoInit();
}
}, 100);
}, [path]);
return null;
}