Browse Source

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.
master
TheoryOfNekomata 3 years ago
parent
commit
f6a9a56abb
4 changed files with 53 additions and 16 deletions
  1. +6
    -0
      .npmignore
  2. +22
    -4
      package.json
  3. +0
    -0
      src/index.ts
  4. +25
    -12
      src/layouts/LeftSidebarWithMenu/index.tsx

+ 6
- 0
.npmignore View File

@@ -0,0 +1,6 @@
example/
node_modules/
src/
.editorconfig
tsconfig.json
yarn.lock

+ 22
- 4
package.json View File

@@ -1,12 +1,30 @@
{ {
"version": "0.1.1",
"version": "0.2.0",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"files": [ "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": { "engines": {
"node": ">=10" "node": ">=10"
}, },
@@ -28,7 +46,7 @@
"pre-commit": "tsdx lint" "pre-commit": "tsdx lint"
} }
}, },
"name": "@tesseract-design/viewfinder",
"name": "@theoryofnekomata/viewfinder",
"description": "Layout scaffolding for Web apps.", "description": "Layout scaffolding for Web apps.",
"author": "TheoryOfNekomata <allan.crisostomo@outlook.com>", "author": "TheoryOfNekomata <allan.crisostomo@outlook.com>",
"module": "dist/viewfinder.esm.js", "module": "dist/viewfinder.esm.js",


src/index.tsx → src/index.ts View File


+ 25
- 12
src/layouts/LeftSidebarWithMenu/index.tsx View File

@@ -296,7 +296,7 @@ export type MenuItem = BaseMenuItem & {


type Props = { type Props = {
brand?: React.ReactNode, brand?: React.ReactNode,
sidebarMain: React.ReactChild,
sidebarMain?: React.ReactChild,
sidebarMainOpen?: boolean, sidebarMainOpen?: boolean,
sidebarMenuItems: MenuItem[], sidebarMenuItems: MenuItem[],
moreItemsOpen?: boolean, moreItemsOpen?: boolean,
@@ -353,7 +353,7 @@ export const Layout: React.FC<Props> = ({
<TopBar <TopBar
wide wide
brand={brand} brand={brand}
menuLink={menuLink}
menuLink={sidebarMain ? menuLink : undefined}
userLink={userLink} userLink={userLink}
> >
{topBarCenter} {topBarCenter}
@@ -404,13 +404,21 @@ export const Layout: React.FC<Props> = ({
</MoreSecondarySidebarMenuGroup> </MoreSecondarySidebarMenuGroup>
</MoreItemsScroll> </MoreItemsScroll>
</MoreItemsComponent> </MoreItemsComponent>
<MoreToggleSidebarMenuItem>
<SidebarMenuItem>
<LinkComponent
{...moreLinkMenuItem}
/>
</SidebarMenuItem>
</MoreToggleSidebarMenuItem>
{
(
morePrimarySidebarMenuItems.length > 0
|| moreSecondarySidebarMenuItems.length > 0
)
&& (
<MoreToggleSidebarMenuItem>
<SidebarMenuItem>
<LinkComponent
{...moreLinkMenuItem}
/>
</SidebarMenuItem>
</MoreToggleSidebarMenuItem>
)
}
{ {
visibleSecondarySidebarMenuItems.length > 0 visibleSecondarySidebarMenuItems.length > 0
&& ( && (
@@ -429,9 +437,14 @@ export const Layout: React.FC<Props> = ({
} }
</SidebarMenuSize> </SidebarMenuSize>
</SidebarMenu> </SidebarMenu>
<SidebarMainComponent>
{sidebarMain}
</SidebarMainComponent>
{
(sidebarMain as unknown)
&& (
<SidebarMainComponent>
{sidebarMain}
</SidebarMainComponent>
)
}
</SidebarBase> </SidebarBase>
<ContentBase> <ContentBase>
{children} {children}


Loading…
Cancel
Save