From f179b2bc9a0e9ae78325f69917a3b906c42d8bdb Mon Sep 17 00:00:00 2001 From: ldrv565 <40745264+ldrv565@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:13:34 +0300 Subject: [PATCH] feat: add AsideFallback --- README.md | 27 +++++++++---- rollup.config.js | 1 + src/components/AsideHeader/AsideHeader.scss | 4 -- src/components/AsideHeader/AsideHeader.tsx | 15 ------- .../__stories__/AsideHeader.stories.tsx | 37 ++++++++++++++++- .../components/PageLayout/AsideFallback.tsx | 40 +++++++++++++++++++ .../components/PageLayout/PageLayout.tsx | 21 ++++++---- src/components/AsideHeader/types.tsx | 1 - src/components/index.ts | 1 + 9 files changed, 110 insertions(+), 37 deletions(-) create mode 100644 src/components/AsideHeader/components/PageLayout/AsideFallback.tsx diff --git a/README.md b/README.md index 3e6f8ac..3d7bf6e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ npm install --dev @gravity-ui/uikit@^3.0.2 @bem-react/classname@1.6.0 react@^16. - DrawerItem - PageLayout - PageLayoutAside +- AsideFallback ## Optimization @@ -33,23 +34,35 @@ If your app content needs to be rendered faster than by passing it throw `AsideH you may need to switch usage of `AsideHeader` to advanced style with `PageLayout` like this: ```diff --import {AsideHeader} from '@gravity-ui/navigation'; -+import {PageLayout} from '@gravity-ui/navigation'; -+ -+const PageLayoutAside = React.lazy(() => -+ import('@gravity-ui/navigation').then((module) => ({default: module.PageLayoutAside})), +--- Main.tsx ++++ Main.tsx +-import {AsideHeader} from './AsideHeader' ++import {PageLayout, AsideFallback} from '@gravity-ui/navigation'; ++const Aside = React.lazy(() => ++ import('./Aside').then(({Aside}) => ({ default: Aside })) +); - + -+ -+ ++ }> ++