"use client"; import React, { ReactElement } from "react"; import GeneralHeader from "./GeneralHeader"; import GeneralFooter from "./GeneralFooter"; import { gsap } from "gsap"; import BG from "./BG"; export const SiteContext: any = React.createContext({}); type GeneralLayoutProps = { children: React.ReactNode; }; const GeneralLayout = ({ children }: GeneralLayoutProps): ReactElement => { const [readyState, setReadyState] = React.useState(false); React.useEffect(() => { const links: NodeListOf | null = document.querySelectorAll("nav a"); links?.forEach((link) => { if (link.dataset.href === window.location.pathname) { link.classList.add("active-page"); } if (window.location.pathname.match(new RegExp(`${link.dataset.href}\\/.*`))) { link.classList.add("active-page"); } }); gsap.to("#main-content-wrapper", { opacity: 1, duration: 2, }); }, []); return (
{children}
); }; export default GeneralLayout;