Skip to content

Commit

Permalink
fix(marketingmain): footer sidebar dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin.apolinario committed Nov 1, 2023
1 parent e4a678d commit 393ec1f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/layouts/Main/MarketingMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import useIsLoggedIn from 'components/hooks/useIsLoggedIn';
import { setCookie } from 'cookies-next';
import { useZestyStore } from 'store';

import { Topbar, Sidebar, Footer } from './components';
import { Topbar } from './components';

import dynamic from 'next/dynamic';
import revampTheme from 'theme/revampTheme';

const Footer = dynamic(() => import('./components/Footer/FooterDynamic'));
const Sidebar = dynamic(() => import('./components').then((e) => e.Sidebar));
const TopNav = dynamic(() => import('components/globals/TopNav'));
const SiteBanner = dynamic(
() => import('components/marketing/SiteBanner/SiteBanner'),
Expand Down
16 changes: 16 additions & 0 deletions src/layouts/Main/components/Footer/FooterDynamic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import dynamic from 'next/dynamic';
import { useInView } from 'react-intersection-observer';

const Child = dynamic(() => import('./Footer'), {
loading: () => <></>,
});

const Index = (props) => {
const { ref, inView } = useInView({
triggerOnce: true,
threshold: 0,
});
return <div ref={ref}>{inView && <Child {...props} />}</div>;
};

export default Index;
1 change: 0 additions & 1 deletion src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import '/public/styles/docs.css';

if (process.env.NODE_ENV === 'production') {
console.log = () => {};
console.error = () => {};
console.debug = () => {};
}

Expand Down

0 comments on commit 393ec1f

Please sign in to comment.