From 6e08a9188fd53d245c6f1c117099622e3ce755a8 Mon Sep 17 00:00:00 2001 From: ldrv565 <40745264+ldrv565@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:24:19 +0300 Subject: [PATCH] feat: add AsideFallback (#161) * feat: add AsideFallback * chore: share HEADER_DIVIDER_HEIGHT --- README.md | 27 +++++++++---- rollup.config.js | 1 + src/components/AsideHeader/AsideHeader.scss | 4 -- src/components/AsideHeader/AsideHeader.tsx | 15 -------- .../__stories__/AsideHeader.stories.tsx | 37 +++++++++++++++++- .../AsideHeader/components/Header.tsx | 4 +- .../components/PageLayout/AsideFallback.tsx | 38 +++++++++++++++++++ .../components/PageLayout/PageLayout.tsx | 21 ++++++---- src/components/AsideHeader/types.tsx | 1 - src/components/CompositeBar/constants.ts | 1 - src/components/CompositeBar/utils.ts | 3 +- src/components/constants.ts | 2 + src/components/index.ts | 1 + 13 files changed, 114 insertions(+), 41 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 })) +); - + -+ -+ ++ }> ++