mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
lazy demo
This commit is contained in:
parent
be7d22dec1
commit
a695869aa0
15
frontend/src/component/demo/LazyDemo.tsx
Normal file
15
frontend/src/component/demo/LazyDemo.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import { FC, Suspense, lazy } from 'react';
|
||||
|
||||
const LazyDemoComponent = lazy(() =>
|
||||
import('./Demo').then(module => ({
|
||||
default: module.Demo,
|
||||
}))
|
||||
);
|
||||
|
||||
export const LazyDemo: FC = ({ children }) => (
|
||||
<Suspense fallback={<>{children}</>}>
|
||||
<LazyDemoComponent>
|
||||
<>{children}</>
|
||||
</LazyDemoComponent>
|
||||
</Suspense>
|
||||
);
|
@ -14,7 +14,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import { DraftBanner } from './DraftBanner/DraftBanner';
|
||||
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
|
||||
import { Demo } from 'component/demo/Demo';
|
||||
import { LazyDemo } from 'component/demo/LazyDemo';
|
||||
|
||||
interface IMainLayoutProps {
|
||||
children: ReactNode;
|
||||
@ -85,7 +85,7 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
|
||||
return (
|
||||
<>
|
||||
<SkipNavLink />
|
||||
<Demo>
|
||||
<LazyDemo>
|
||||
<>
|
||||
<Header />
|
||||
<SkipNavTarget />
|
||||
@ -128,7 +128,7 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
|
||||
<Footer />
|
||||
</MainLayoutContainer>
|
||||
</>
|
||||
</Demo>
|
||||
</LazyDemo>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user