@xyo-network/react-appbar 2.25.38 → 2.25.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Toolbar/System/DefaultMenuItems.d.ts +2 -0
- package/dist/cjs/components/Toolbar/System/DefaultMenuItems.js +13 -0
- package/dist/cjs/components/Toolbar/System/DefaultMenuItems.js.map +1 -0
- package/dist/cjs/components/Toolbar/System/SiteMenu.d.ts +3 -2
- package/dist/cjs/components/Toolbar/System/SiteMenu.js +7 -29
- package/dist/cjs/components/Toolbar/System/SiteMenu.js.map +1 -1
- package/dist/cjs/components/Toolbar/System/SystemToolbar.d.ts +2 -3
- package/dist/cjs/components/Toolbar/System/SystemToolbar.js +2 -2
- package/dist/cjs/components/Toolbar/System/SystemToolbar.js.map +1 -1
- package/dist/docs.json +1272 -1235
- package/dist/esm/components/Toolbar/System/DefaultMenuItems.d.ts +2 -0
- package/dist/esm/components/Toolbar/System/DefaultMenuItems.js +8 -0
- package/dist/esm/components/Toolbar/System/DefaultMenuItems.js.map +1 -0
- package/dist/esm/components/Toolbar/System/SiteMenu.d.ts +3 -2
- package/dist/esm/components/Toolbar/System/SiteMenu.js +10 -32
- package/dist/esm/components/Toolbar/System/SiteMenu.js.map +1 -1
- package/dist/esm/components/Toolbar/System/SystemToolbar.d.ts +2 -3
- package/dist/esm/components/Toolbar/System/SystemToolbar.js +2 -2
- package/dist/esm/components/Toolbar/System/SystemToolbar.js.map +1 -1
- package/package.json +18 -18
- package/src/components/Toolbar/System/DefaultMenuItems.tsx +18 -0
- package/src/components/Toolbar/System/SiteMenu.tsx +21 -55
- package/src/components/Toolbar/System/SystemToolbar.tsx +5 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import SettingsIcon from '@mui/icons-material/Settings';
|
|
3
|
+
import { List, ListItem, ListItemIcon, ListItemText } from '@mui/material';
|
|
4
|
+
import { ListItemButtonEx } from '@xyo-network/react-shared';
|
|
5
|
+
export const DefaultMenuItems = () => {
|
|
6
|
+
return (_jsx(List, { children: _jsx(ListItem, { disablePadding: true, children: _jsxs(ListItemButtonEx, { to: "/settings", children: [_jsx(ListItemIcon, { children: _jsx(SettingsIcon, {}) }), _jsx(ListItemText, { primary: "Settings" })] }) }) }));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=DefaultMenuItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultMenuItems.js","sourceRoot":"","sources":["../../../../../src/components/Toolbar/System/DefaultMenuItems.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,MAAM,CAAC,MAAM,gBAAgB,GAAa,GAAG,EAAE;IAC7C,OAAO,CACL,KAAC,IAAI,cACH,KAAC,QAAQ,IAAC,cAAc,kBACtB,MAAC,gBAAgB,IAAC,EAAE,EAAC,WAAW,aAC9B,KAAC,YAAY,cACX,KAAC,YAAY,KAAG,GACH,EACf,KAAC,YAAY,IAAC,OAAO,EAAC,UAAU,GAAG,IAClB,GACV,GACN,CACR,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FlexBoxProps } from '@xylabs/sdk-react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
import { To } from 'react-router-dom';
|
|
4
4
|
export interface SiteMenuItem {
|
|
5
5
|
name: string;
|
|
@@ -9,6 +9,7 @@ export interface SiteMenuItem {
|
|
|
9
9
|
}
|
|
10
10
|
export interface SiteMenuProps extends FlexBoxProps {
|
|
11
11
|
hideSettingsMenuItem?: boolean;
|
|
12
|
-
|
|
12
|
+
menu?: ReactNode;
|
|
13
|
+
side?: 'left' | 'right' | 'top' | 'bottom';
|
|
13
14
|
}
|
|
14
15
|
export declare const SiteMenu: React.FC<SiteMenuProps>;
|
|
@@ -1,35 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { FlexRow
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
export const SiteMenu = ({
|
|
8
|
-
const [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
setMenuElement(null);
|
|
13
|
-
};
|
|
14
|
-
const ref = useRef(null);
|
|
15
|
-
return (_jsxs(FlexRow, { alignItems: "stretch", ...props, children: [_jsx(LinkEx, { color: "inherit", onClick: () => {
|
|
16
|
-
setMenuElement(ref.current);
|
|
17
|
-
}, children: _jsx("div", { style: { alignItems: 'center', cursor: 'pointer', display: 'flex' }, ref: ref, children: _jsx(MenuIcon, { fontSize: "large" }) }) }), _jsxs(Menu, { anchorEl: menuElement, open: open, onClose: handleMenuClose, children: [menuItems?.map(({ name, to, href, onClick }) => {
|
|
18
|
-
return (_jsx(MenuItem, { onClick: () => {
|
|
19
|
-
if (onClick) {
|
|
20
|
-
onClick();
|
|
21
|
-
}
|
|
22
|
-
else if (to) {
|
|
23
|
-
navigate(to);
|
|
24
|
-
}
|
|
25
|
-
else if (href) {
|
|
26
|
-
window.open(href);
|
|
27
|
-
}
|
|
28
|
-
handleMenuClose();
|
|
29
|
-
}, disableRipple: true, children: name }, name));
|
|
30
|
-
}), hideSettingsMenuItem ? null : (_jsx(MenuItem, { onClick: () => {
|
|
31
|
-
navigate('/settings');
|
|
32
|
-
handleMenuClose();
|
|
33
|
-
}, disableRipple: true, children: "Settings" }))] })] }));
|
|
2
|
+
import MenuIcon from '@mui/icons-material/Menu';
|
|
3
|
+
import { Box, IconButton, SwipeableDrawer } from '@mui/material';
|
|
4
|
+
import { FlexRow } from '@xylabs/sdk-react';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { DefaultMenuItems } from './DefaultMenuItems';
|
|
7
|
+
export const SiteMenu = ({ side, menu, ...props }) => {
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
return (_jsxs(FlexRow, { alignItems: "stretch", ...props, children: [_jsx(IconButton, { size: "small", color: "inherit", onClick: () => {
|
|
10
|
+
setOpen(!open);
|
|
11
|
+
}, children: _jsx(MenuIcon, { fontSize: "large" }) }), _jsx(SwipeableDrawer, { anchor: side ?? 'left', open: open, onClose: () => setOpen(false), onOpen: () => setOpen(true), children: _jsx(Box, { width: "auto", role: "presentation", onClick: () => setOpen(false), onKeyDown: () => setOpen(false), children: menu ?? _jsx(DefaultMenuItems, {}) }) })] }));
|
|
34
12
|
};
|
|
35
13
|
//# sourceMappingURL=SiteMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteMenu.js","sourceRoot":"","sources":["../../../../../src/components/Toolbar/System/SiteMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SiteMenu.js","sourceRoot":"","sources":["../../../../../src/components/Toolbar/System/SiteMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,QAAQ,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAgB,OAAO,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAerD,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC5E,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEvC,OAAO,CACL,MAAC,OAAO,IAAC,UAAU,EAAC,SAAS,KAAK,KAAK,aACrC,KAAC,UAAU,IACT,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;gBAChB,CAAC,YAED,KAAC,QAAQ,IAAC,QAAQ,EAAC,OAAO,GAAG,GAClB,EACb,KAAC,eAAe,IAAC,MAAM,EAAE,IAAI,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAC7G,KAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YACjG,IAAI,IAAI,KAAC,gBAAgB,KAAG,GACzB,GACU,IACV,CACX,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ToolbarProps } from '@mui/material';
|
|
3
2
|
import { SelectExProps } from '@xylabs/sdk-react';
|
|
4
3
|
import { NetworkSelectExProps } from '@xyo-network/react-network';
|
|
5
|
-
import {
|
|
4
|
+
import { ReactNode } from 'react';
|
|
6
5
|
export interface SystemToolbarProps extends ToolbarProps {
|
|
7
6
|
networkSelectProps?: NetworkSelectExProps;
|
|
8
7
|
archiveSelectProps?: SelectExProps<string>;
|
|
9
8
|
hideNetworkSelect?: boolean;
|
|
10
9
|
hideArchiveSelect?: boolean;
|
|
11
|
-
|
|
10
|
+
menuItems?: ReactNode;
|
|
12
11
|
darkModeButton?: boolean;
|
|
13
12
|
authButton?: boolean;
|
|
14
13
|
noMenu?: boolean;
|
|
@@ -6,7 +6,7 @@ import { AuthStatusIconButton } from '@xyo-network/react-auth';
|
|
|
6
6
|
import { NetworkSelectEx } from '@xyo-network/react-network';
|
|
7
7
|
import { DarkModeIconButton } from '@xyo-network/react-shared';
|
|
8
8
|
import { SiteMenu } from './SiteMenu';
|
|
9
|
-
export const SystemToolbar = ({ children, networkSelectProps, archiveSelectProps, hideNetworkSelect, hideArchiveSelect,
|
|
10
|
-
return (_jsxs(Toolbar, { ...props, children: [hideNetworkSelect ? null : (_jsx(FlexRow, { marginX: 0.5, maxWidth: 120, children: _jsx(Paper, { variant: "elevation", children: _jsx(NetworkSelectEx, { fullWidth: true, ...networkSelectProps }) }) })), hideArchiveSelect ? null : (_jsx(FlexRow, { marginX: 0.5, maxWidth: 120, children: _jsx(Paper, { variant: "elevation", children: _jsx(ArchiveSelectEx, { fullWidth: true, ...archiveSelectProps }) }) })), children, authButton ? _jsx(AuthStatusIconButton, { color: "inherit" }) : null, darkModeButton ? _jsx(DarkModeIconButton, { color: "inherit" }) : null, noMenu ? null : _jsx(SiteMenu, {
|
|
9
|
+
export const SystemToolbar = ({ children, networkSelectProps, archiveSelectProps, hideNetworkSelect, hideArchiveSelect, menuItems, darkModeButton = false, authButton = false, noMenu = false, ...props }) => {
|
|
10
|
+
return (_jsxs(Toolbar, { ...props, children: [hideNetworkSelect ? null : (_jsx(FlexRow, { marginX: 0.5, maxWidth: 120, children: _jsx(Paper, { variant: "elevation", children: _jsx(NetworkSelectEx, { fullWidth: true, ...networkSelectProps }) }) })), hideArchiveSelect ? null : (_jsx(FlexRow, { marginX: 0.5, maxWidth: 120, children: _jsx(Paper, { variant: "elevation", children: _jsx(ArchiveSelectEx, { fullWidth: true, ...archiveSelectProps }) }) })), children, authButton ? _jsx(AuthStatusIconButton, { color: "inherit" }) : null, darkModeButton ? _jsx(DarkModeIconButton, { color: "inherit" }) : null, noMenu ? null : _jsx(SiteMenu, { menu: menuItems })] }));
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=SystemToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemToolbar.js","sourceRoot":"","sources":["../../../../../src/components/Toolbar/System/SystemToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAiB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"SystemToolbar.js","sourceRoot":"","sources":["../../../../../src/components/Toolbar/System/SystemToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAiB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAG9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAarC,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,cAAc,GAAG,KAAK,EACtB,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,KAAK,EACd,GAAG,KAAK,EACT,EAAE,EAAE;IACH,OAAO,CACL,MAAC,OAAO,OAAK,KAAK,aACf,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC1B,KAAC,OAAO,IAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAClC,KAAC,KAAK,IAAC,OAAO,EAAC,WAAW,YACxB,KAAC,eAAe,IAAC,SAAS,WAAK,kBAAkB,GAAI,GAC/C,GACA,CACX,EACA,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC1B,KAAC,OAAO,IAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAClC,KAAC,KAAK,IAAC,OAAO,EAAC,WAAW,YACxB,KAAC,eAAe,IAAC,SAAS,WAAK,kBAAkB,GAAI,GAC/C,GACA,CACX,EACA,QAAQ,EACR,UAAU,CAAC,CAAC,CAAC,KAAC,oBAAoB,IAAC,KAAK,EAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,EAC5D,cAAc,CAAC,CAAC,CAAC,KAAC,kBAAkB,IAAC,KAAK,EAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,EAC9D,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,IAAI,EAAE,SAAS,GAAI,IACtC,CACX,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@emotion/react": "^11.9.0",
|
|
14
14
|
"@emotion/styled": "^11.8.1",
|
|
15
|
-
"@mui/icons-material": "^5.8.
|
|
16
|
-
"@mui/material": "^5.8.
|
|
17
|
-
"@xylabs/sdk-react": "^2.13.
|
|
18
|
-
"@xyo-network/core": "^2.20.
|
|
19
|
-
"@xyo-network/react-archive": "^2.25.
|
|
20
|
-
"@xyo-network/react-archivist-api": "^2.25.
|
|
21
|
-
"@xyo-network/react-auth": "^2.25.
|
|
22
|
-
"@xyo-network/react-network": "^2.25.
|
|
23
|
-
"@xyo-network/react-shared": "^2.25.
|
|
24
|
-
"@xyo-network/react-theme": "^2.25.
|
|
15
|
+
"@mui/icons-material": "^5.8.3",
|
|
16
|
+
"@mui/material": "^5.8.3",
|
|
17
|
+
"@xylabs/sdk-react": "^2.13.7",
|
|
18
|
+
"@xyo-network/core": "^2.20.44",
|
|
19
|
+
"@xyo-network/react-archive": "^2.25.41",
|
|
20
|
+
"@xyo-network/react-archivist-api": "^2.25.41",
|
|
21
|
+
"@xyo-network/react-auth": "^2.25.41",
|
|
22
|
+
"@xyo-network/react-network": "^2.25.41",
|
|
23
|
+
"@xyo-network/react-shared": "^2.25.41",
|
|
24
|
+
"@xyo-network/react-theme": "^2.25.41",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
26
|
"react": "^18.1.0",
|
|
27
27
|
"react-dom": "^18.1.0",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/core": "^7.18.2",
|
|
35
35
|
"@babel/preset-env": "^7.18.2",
|
|
36
|
-
"@storybook/addons": "^6.5.
|
|
37
|
-
"@storybook/api": "^6.5.
|
|
38
|
-
"@storybook/components": "^6.5.
|
|
39
|
-
"@storybook/core-events": "^6.5.
|
|
40
|
-
"@storybook/react": "^6.5.
|
|
41
|
-
"@storybook/theming": "^6.5.
|
|
36
|
+
"@storybook/addons": "^6.5.8",
|
|
37
|
+
"@storybook/api": "^6.5.8",
|
|
38
|
+
"@storybook/components": "^6.5.8",
|
|
39
|
+
"@storybook/core-events": "^6.5.8",
|
|
40
|
+
"@storybook/react": "^6.5.8",
|
|
41
|
+
"@storybook/theming": "^6.5.8",
|
|
42
42
|
"@types/lodash": "^4.14.182",
|
|
43
|
-
"@xylabs/sdk-react": "^2.13.
|
|
43
|
+
"@xylabs/sdk-react": "^2.13.7",
|
|
44
44
|
"@xylabs/ts-scripts": "^1.0.66",
|
|
45
45
|
"@xylabs/tsconfig": "^1.0.13",
|
|
46
46
|
"axios": "^0.27.2",
|
|
@@ -105,6 +105,6 @@
|
|
|
105
105
|
},
|
|
106
106
|
"sideEffects": false,
|
|
107
107
|
"types": "dist/esm/index.d.ts",
|
|
108
|
-
"version": "2.25.
|
|
108
|
+
"version": "2.25.41",
|
|
109
109
|
"packageManager": "yarn@3.1.1"
|
|
110
110
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import SettingsIcon from '@mui/icons-material/Settings'
|
|
2
|
+
import { List, ListItem, ListItemIcon, ListItemText } from '@mui/material'
|
|
3
|
+
import { ListItemButtonEx } from '@xyo-network/react-shared'
|
|
4
|
+
|
|
5
|
+
export const DefaultMenuItems: React.FC = () => {
|
|
6
|
+
return (
|
|
7
|
+
<List>
|
|
8
|
+
<ListItem disablePadding>
|
|
9
|
+
<ListItemButtonEx to="/settings">
|
|
10
|
+
<ListItemIcon>
|
|
11
|
+
<SettingsIcon />
|
|
12
|
+
</ListItemIcon>
|
|
13
|
+
<ListItemText primary="Settings" />
|
|
14
|
+
</ListItemButtonEx>
|
|
15
|
+
</ListItem>
|
|
16
|
+
</List>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { FlexBoxProps, FlexRow
|
|
4
|
-
import {
|
|
5
|
-
import { To
|
|
1
|
+
import MenuIcon from '@mui/icons-material/Menu'
|
|
2
|
+
import { Box, IconButton, SwipeableDrawer } from '@mui/material'
|
|
3
|
+
import { FlexBoxProps, FlexRow } from '@xylabs/sdk-react'
|
|
4
|
+
import { ReactNode, useState } from 'react'
|
|
5
|
+
import { To } from 'react-router-dom'
|
|
6
|
+
|
|
7
|
+
import { DefaultMenuItems } from './DefaultMenuItems'
|
|
6
8
|
|
|
7
9
|
export interface SiteMenuItem {
|
|
8
10
|
name: string
|
|
@@ -13,65 +15,29 @@ export interface SiteMenuItem {
|
|
|
13
15
|
|
|
14
16
|
export interface SiteMenuProps extends FlexBoxProps {
|
|
15
17
|
hideSettingsMenuItem?: boolean
|
|
16
|
-
|
|
18
|
+
menu?: ReactNode
|
|
19
|
+
side?: 'left' | 'right' | 'top' | 'bottom'
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
export const SiteMenu: React.FC<SiteMenuProps> = ({
|
|
20
|
-
const [
|
|
21
|
-
const open = Boolean(menuElement)
|
|
22
|
-
const navigate = useNavigate()
|
|
23
|
-
|
|
24
|
-
const handleMenuClose = () => {
|
|
25
|
-
setMenuElement(null)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const ref = useRef(null)
|
|
22
|
+
export const SiteMenu: React.FC<SiteMenuProps> = ({ side, menu, ...props }) => {
|
|
23
|
+
const [open, setOpen] = useState(false)
|
|
29
24
|
|
|
30
25
|
return (
|
|
31
26
|
<FlexRow alignItems="stretch" {...props}>
|
|
32
|
-
<
|
|
27
|
+
<IconButton
|
|
28
|
+
size="small"
|
|
33
29
|
color="inherit"
|
|
34
30
|
onClick={() => {
|
|
35
|
-
|
|
31
|
+
setOpen(!open)
|
|
36
32
|
}}
|
|
37
33
|
>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<MenuItem
|
|
46
|
-
key={name}
|
|
47
|
-
onClick={() => {
|
|
48
|
-
if (onClick) {
|
|
49
|
-
onClick()
|
|
50
|
-
} else if (to) {
|
|
51
|
-
navigate(to)
|
|
52
|
-
} else if (href) {
|
|
53
|
-
window.open(href)
|
|
54
|
-
}
|
|
55
|
-
handleMenuClose()
|
|
56
|
-
}}
|
|
57
|
-
disableRipple
|
|
58
|
-
>
|
|
59
|
-
{name}
|
|
60
|
-
</MenuItem>
|
|
61
|
-
)
|
|
62
|
-
})}
|
|
63
|
-
{hideSettingsMenuItem ? null : (
|
|
64
|
-
<MenuItem
|
|
65
|
-
onClick={() => {
|
|
66
|
-
navigate('/settings')
|
|
67
|
-
handleMenuClose()
|
|
68
|
-
}}
|
|
69
|
-
disableRipple
|
|
70
|
-
>
|
|
71
|
-
Settings
|
|
72
|
-
</MenuItem>
|
|
73
|
-
)}
|
|
74
|
-
</Menu>
|
|
34
|
+
<MenuIcon fontSize="large" />
|
|
35
|
+
</IconButton>
|
|
36
|
+
<SwipeableDrawer anchor={side ?? 'left'} open={open} onClose={() => setOpen(false)} onOpen={() => setOpen(true)}>
|
|
37
|
+
<Box width="auto" role="presentation" onClick={() => setOpen(false)} onKeyDown={() => setOpen(false)}>
|
|
38
|
+
{menu ?? <DefaultMenuItems />}
|
|
39
|
+
</Box>
|
|
40
|
+
</SwipeableDrawer>
|
|
75
41
|
</FlexRow>
|
|
76
42
|
)
|
|
77
43
|
}
|
|
@@ -4,15 +4,16 @@ import { ArchiveSelectEx } from '@xyo-network/react-archive'
|
|
|
4
4
|
import { AuthStatusIconButton } from '@xyo-network/react-auth'
|
|
5
5
|
import { NetworkSelectEx, NetworkSelectExProps } from '@xyo-network/react-network'
|
|
6
6
|
import { DarkModeIconButton } from '@xyo-network/react-shared'
|
|
7
|
+
import { ReactNode } from 'react'
|
|
7
8
|
|
|
8
|
-
import { SiteMenu
|
|
9
|
+
import { SiteMenu } from './SiteMenu'
|
|
9
10
|
|
|
10
11
|
export interface SystemToolbarProps extends ToolbarProps {
|
|
11
12
|
networkSelectProps?: NetworkSelectExProps
|
|
12
13
|
archiveSelectProps?: SelectExProps<string>
|
|
13
14
|
hideNetworkSelect?: boolean
|
|
14
15
|
hideArchiveSelect?: boolean
|
|
15
|
-
|
|
16
|
+
menuItems?: ReactNode
|
|
16
17
|
darkModeButton?: boolean
|
|
17
18
|
authButton?: boolean
|
|
18
19
|
noMenu?: boolean
|
|
@@ -24,7 +25,7 @@ export const SystemToolbar: React.FC<SystemToolbarProps> = ({
|
|
|
24
25
|
archiveSelectProps,
|
|
25
26
|
hideNetworkSelect,
|
|
26
27
|
hideArchiveSelect,
|
|
27
|
-
|
|
28
|
+
menuItems,
|
|
28
29
|
darkModeButton = false,
|
|
29
30
|
authButton = false,
|
|
30
31
|
noMenu = false,
|
|
@@ -49,7 +50,7 @@ export const SystemToolbar: React.FC<SystemToolbarProps> = ({
|
|
|
49
50
|
{children}
|
|
50
51
|
{authButton ? <AuthStatusIconButton color="inherit" /> : null}
|
|
51
52
|
{darkModeButton ? <DarkModeIconButton color="inherit" /> : null}
|
|
52
|
-
{noMenu ? null : <SiteMenu {
|
|
53
|
+
{noMenu ? null : <SiteMenu menu={menuItems} />}
|
|
53
54
|
</Toolbar>
|
|
54
55
|
)
|
|
55
56
|
}
|