From f6a9a56abb9fac104f72f88bdd133e4bebf80283 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Sun, 23 May 2021 14:03:56 +0800 Subject: [PATCH] Republish package, fix left sidebar layout Use `@theoryofnekomata` scope to publish package on different registries. The "More" logic in LeftSidebarWithMenu logic has been updated to only show when more sidebar items are visible. --- .npmignore | 6 ++++ package.json | 26 +++++++++++++--- src/{index.tsx => index.ts} | 0 src/layouts/LeftSidebarWithMenu/index.tsx | 37 +++++++++++++++-------- 4 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 .npmignore rename src/{index.tsx => index.ts} (100%) diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..44eced6 --- /dev/null +++ b/.npmignore @@ -0,0 +1,6 @@ +example/ +node_modules/ +src/ +.editorconfig +tsconfig.json +yarn.lock diff --git a/package.json b/package.json index 2c514f9..9c956e9 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,30 @@ { - "version": "0.1.1", + "version": "0.2.0", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ - "dist", - "src" + "dist" ], + "publishing": { + "github": { + "repository": "https://github.com/TheoryOfNekomata/viewfinder.git", + "publishConfig": { + "registry": "https://npm.pkg.github.com" + } + }, + "master": { + "repository": "https://code.modal.sh/TheoryOfNekomata/viewfinder.git", + "publishConfig": { + "registry": "https://js.pack.modal.sh" + } + }, + "npm": { + "publishConfig": { + "registry": "https://registry.npmjs.com" + } + } + }, "engines": { "node": ">=10" }, @@ -28,7 +46,7 @@ "pre-commit": "tsdx lint" } }, - "name": "@tesseract-design/viewfinder", + "name": "@theoryofnekomata/viewfinder", "description": "Layout scaffolding for Web apps.", "author": "TheoryOfNekomata ", "module": "dist/viewfinder.esm.js", diff --git a/src/index.tsx b/src/index.ts similarity index 100% rename from src/index.tsx rename to src/index.ts diff --git a/src/layouts/LeftSidebarWithMenu/index.tsx b/src/layouts/LeftSidebarWithMenu/index.tsx index 78bb516..421c3e8 100644 --- a/src/layouts/LeftSidebarWithMenu/index.tsx +++ b/src/layouts/LeftSidebarWithMenu/index.tsx @@ -296,7 +296,7 @@ export type MenuItem = BaseMenuItem & { type Props = { brand?: React.ReactNode, - sidebarMain: React.ReactChild, + sidebarMain?: React.ReactChild, sidebarMainOpen?: boolean, sidebarMenuItems: MenuItem[], moreItemsOpen?: boolean, @@ -353,7 +353,7 @@ export const Layout: React.FC = ({ {topBarCenter} @@ -404,13 +404,21 @@ export const Layout: React.FC = ({ - - - - - + { + ( + morePrimarySidebarMenuItems.length > 0 + || moreSecondarySidebarMenuItems.length > 0 + ) + && ( + + + + + + ) + } { visibleSecondarySidebarMenuItems.length > 0 && ( @@ -429,9 +437,14 @@ export const Layout: React.FC = ({ } - - {sidebarMain} - + { + (sidebarMain as unknown) + && ( + + {sidebarMain} + + ) + } {children}