@xyo-network/react-appbar 2.35.12 → 2.36.0
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/CollapsibleDrawer/ExampleMenuData.d.ts +4 -0
- package/dist/cjs/components/CollapsibleDrawer/ExampleMenuData.d.ts.map +1 -0
- package/dist/cjs/components/CollapsibleDrawer/ExampleMenuData.js +65 -0
- package/dist/cjs/components/CollapsibleDrawer/ExampleMenuData.js.map +1 -0
- package/dist/cjs/components/SiteMenu/MenuItems.d.ts +12 -0
- package/dist/cjs/components/SiteMenu/MenuItems.d.ts.map +1 -1
- package/dist/cjs/components/SiteMenu/MenuItems.js +11 -2
- package/dist/cjs/components/SiteMenu/MenuItems.js.map +1 -1
- package/dist/cjs/components/SiteMenu/MenuListItemButtonEx.js +1 -1
- package/dist/cjs/components/SiteMenu/MenuListItemButtonEx.js.map +1 -1
- package/dist/docs.json +399 -136
- package/dist/esm/components/CollapsibleDrawer/ExampleMenuData.d.ts +4 -0
- package/dist/esm/components/CollapsibleDrawer/ExampleMenuData.d.ts.map +1 -0
- package/dist/esm/components/CollapsibleDrawer/ExampleMenuData.js +62 -0
- package/dist/esm/components/CollapsibleDrawer/ExampleMenuData.js.map +1 -0
- package/dist/esm/components/SiteMenu/MenuItems.d.ts +12 -0
- package/dist/esm/components/SiteMenu/MenuItems.d.ts.map +1 -1
- package/dist/esm/components/SiteMenu/MenuItems.js +11 -2
- package/dist/esm/components/SiteMenu/MenuItems.js.map +1 -1
- package/dist/esm/components/SiteMenu/MenuListItemButtonEx.js +1 -1
- package/dist/esm/components/SiteMenu/MenuListItemButtonEx.js.map +1 -1
- package/package.json +7 -6
- package/src/components/CollapsibleDrawer/CollapseDrawer.stories.tsx +20 -15
- package/src/components/CollapsibleDrawer/ExampleMenuData.tsx +74 -0
- package/src/components/SiteMenu/MenuItem.stories.tsx +9 -10
- package/src/components/SiteMenu/MenuItems.tsx +71 -8
- package/src/components/SiteMenu/MenuListItemButtonEx.tsx +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExampleMenuData.d.ts","sourceRoot":"","sources":["../../../../src/components/CollapsibleDrawer/ExampleMenuData.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,eAAO,MAAM,WAAW,EAAE,qBAAqB,EAgC9C,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,qBAAqB,EAyBjD,CAAA"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { VscAccount, VscGlobe, VscGraph, VscGraphLine, VscJson, VscServer, VscSettingsGear, VscSymbolMethod, VscSymbolNamespace, } from 'react-icons/vsc';
|
3
|
+
export const menuDataTop = [
|
4
|
+
{
|
5
|
+
icon: _jsx(VscGlobe, {}),
|
6
|
+
primary: 'Explore',
|
7
|
+
subNavListItems: [{ primary: 'Explore', to: '', tooltip: 'View global archivist data on a world map.' }],
|
8
|
+
to: '',
|
9
|
+
tooltip: 'View global archivist data on a world map.',
|
10
|
+
},
|
11
|
+
{
|
12
|
+
icon: _jsx(VscSymbolMethod, {}),
|
13
|
+
primary: 'Blocks',
|
14
|
+
to: '',
|
15
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
16
|
+
},
|
17
|
+
{
|
18
|
+
icon: _jsx(VscSymbolNamespace, {}),
|
19
|
+
primary: 'Payloads',
|
20
|
+
to: '',
|
21
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
22
|
+
},
|
23
|
+
{
|
24
|
+
icon: _jsx(VscGraph, {}),
|
25
|
+
primary: 'Queries',
|
26
|
+
to: '',
|
27
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
28
|
+
},
|
29
|
+
{
|
30
|
+
icon: _jsx(VscServer, {}),
|
31
|
+
primary: 'Archives',
|
32
|
+
to: '',
|
33
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
34
|
+
},
|
35
|
+
];
|
36
|
+
export const menuDataBottom = [
|
37
|
+
{
|
38
|
+
icon: _jsx(VscGraphLine, {}),
|
39
|
+
primary: 'Statistics',
|
40
|
+
to: '',
|
41
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
42
|
+
},
|
43
|
+
{
|
44
|
+
icon: _jsx(VscJson, {}),
|
45
|
+
primary: 'Schema',
|
46
|
+
to: '',
|
47
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
48
|
+
},
|
49
|
+
{
|
50
|
+
icon: _jsx(VscAccount, {}),
|
51
|
+
primary: 'Account',
|
52
|
+
to: '',
|
53
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
54
|
+
},
|
55
|
+
{
|
56
|
+
icon: _jsx(VscSettingsGear, {}),
|
57
|
+
primary: 'Settings',
|
58
|
+
to: '',
|
59
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
60
|
+
},
|
61
|
+
];
|
62
|
+
//# sourceMappingURL=ExampleMenuData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExampleMenuData.js","sourceRoot":"","sources":["../../../../src/components/CollapsibleDrawer/ExampleMenuData.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,SAAS,EACT,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AAIxB,MAAM,CAAC,MAAM,WAAW,GAA4B;IAClD;QACE,IAAI,EAAE,KAAC,QAAQ,KAAG;QAClB,OAAO,EAAE,SAAS;QAClB,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,4CAA4C,EAAE,CAAC;QACxG,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,4CAA4C;KACtD;IACD;QACE,IAAI,EAAE,KAAC,eAAe,KAAG;QACzB,OAAO,EAAE,QAAQ;QACjB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;IACD;QACE,IAAI,EAAE,KAAC,kBAAkB,KAAG;QAC5B,OAAO,EAAE,UAAU;QACnB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;IACD;QACE,IAAI,EAAE,KAAC,QAAQ,KAAG;QAClB,OAAO,EAAE,SAAS;QAClB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;IACD;QACE,IAAI,EAAE,KAAC,SAAS,KAAG;QACnB,OAAO,EAAE,UAAU;QACnB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD;QACE,IAAI,EAAE,KAAC,YAAY,KAAG;QACtB,OAAO,EAAE,YAAY;QACrB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;IACD;QACE,IAAI,EAAE,KAAC,OAAO,KAAG;QACjB,OAAO,EAAE,QAAQ;QACjB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;IACD;QACE,IAAI,EAAE,KAAC,UAAU,KAAG;QACpB,OAAO,EAAE,SAAS;QAClB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;IACD;QACE,IAAI,EAAE,KAAC,eAAe,KAAG;QACzB,OAAO,EAAE,UAAU;QACnB,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,6EAA6E;KACvF;CACF,CAAA"}
|
@@ -6,8 +6,20 @@ import { SiteMenuListItemBase } from './lib';
|
|
6
6
|
export interface SiteMenuListItemProps extends SiteMenuListItemBase, ListItemProps {
|
7
7
|
primary: ListItemTextProps['primary'];
|
8
8
|
to?: To;
|
9
|
+
href?: string;
|
9
10
|
icon?: ReactNode;
|
10
11
|
onButtonClick?: ListItemButtonExProps['onClick'];
|
12
|
+
subNavListItems?: SubNavListItemProps[];
|
13
|
+
tooltip?: string;
|
14
|
+
small?: boolean;
|
15
|
+
}
|
16
|
+
export interface SubNavListItemProps {
|
17
|
+
primary: ListItemTextProps['primary'];
|
18
|
+
to?: To;
|
19
|
+
href?: string;
|
20
|
+
icon?: ReactNode;
|
21
|
+
onButtonClick?: ListItemButtonExProps['onClick'];
|
22
|
+
tooltip?: string;
|
11
23
|
}
|
12
24
|
export declare const SiteMenuListItem: React.FC<SiteMenuListItemProps>;
|
13
25
|
//# sourceMappingURL=MenuItems.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuItems.d.ts","sourceRoot":"","sources":["../../../../src/components/SiteMenu/MenuItems.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"MenuItems.d.ts","sourceRoot":"","sources":["../../../../src/components/SiteMenu/MenuItems.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,aAAa,EAAE,iBAAiB,EAAqB,MAAM,eAAe,CAAA;AAE/G,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAM5C,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB,EAAE,aAAa;IAChF,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;IACrC,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,aAAa,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAA;IAChD,eAAe,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;IACrC,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,aAAa,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAA;IAChD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqE5D,CAAA"}
|
@@ -1,10 +1,19 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Collapse, IconButton, List, Tooltip, useTheme } from '@mui/material';
|
3
|
+
import { FlexRow } from '@xylabs/react-flexbox';
|
4
|
+
import { useState } from 'react';
|
5
|
+
import { VscChevronDown, VscInfo } from 'react-icons/vsc';
|
2
6
|
import { MenuIcon } from './MenuIcon';
|
3
7
|
import { MenuListItem } from './MenuListItem';
|
4
8
|
import { MenuListItemButtonEx } from './MenuListItemButtonEx';
|
5
9
|
import { MenuListItemText } from './MenuListItemText';
|
6
|
-
export const SiteMenuListItem = ({ style,
|
10
|
+
export const SiteMenuListItem = ({ style, subNavListItems, iconOnly, tooltip, small, collapseEnd, icon, primary, onButtonClick, to, ...props }) => {
|
7
11
|
const { dense } = props;
|
8
|
-
|
12
|
+
const theme = useTheme();
|
13
|
+
const [openSubNav, setOpenSubNav] = useState(false);
|
14
|
+
const [hovered, setHovered] = useState(false);
|
15
|
+
return (_jsxs(MenuListItem, { disableGutters: true, style: { whiteSpace: 'nowrap', ...style }, iconOnly: iconOnly, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), ...props, children: [_jsxs(MenuListItemButtonEx, { iconOnly: iconOnly, onClick: onButtonClick, collapseEnd: collapseEnd, dense: dense, to: to, sx: { justifyContent: 'space-between' }, children: [_jsxs(FlexRow, { children: [_jsx(MenuIcon, { icon: icon, fontSize: small ? '14px' : '16px', paddingRight: theme.spacing(1), color: hovered ? theme.palette.primary.main : 'inherit' }), _jsx(MenuListItemText, { primary: primary, iconOnly: iconOnly, sx: { fontSize: small ? theme.typography.caption.fontSize : '' } })] }), _jsxs(FlexRow, { children: [subNavListItems ? (_jsx(IconButton, { onClick: () => setOpenSubNav(!openSubNav), sx: { marginRight: theme.spacing(1) }, children: _jsx(VscChevronDown, { fontSize: small ? '14px' : '16px' }) })) : null, tooltip ? (_jsx(Tooltip, { title: tooltip, placement: "right", children: _jsx("div", { children: _jsx(VscInfo, { color: "disabled" }) }) })) : null] })] }), subNavListItems && !iconOnly ? (_jsx(Collapse, { in: openSubNav, children: _jsx(List, { children: subNavListItems.map((item, index) => {
|
16
|
+
return _jsx(SiteMenuListItem, { ...item }, index);
|
17
|
+
}) }) })) : null] }));
|
9
18
|
};
|
10
19
|
//# sourceMappingURL=MenuItems.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuItems.js","sourceRoot":"","sources":["../../../../src/components/SiteMenu/MenuItems.tsx"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"MenuItems.js","sourceRoot":"","sources":["../../../../src/components/SiteMenu/MenuItems.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAoC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAIzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC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ListItemButtonEx = ({ iconOnly, collapseEnd, sx, children, ...props }) => {
|
4
|
-
const
|
4
|
+
const dense = props;
|
5
5
|
const listItemButtonSx = iconOnly ? { borderRadius: '50%', display: 'inline-flex', flexGrow: 0 } : {};
|
6
6
|
// wait till collapseEnds to remove the spacing between items
|
7
7
|
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuListItemButtonEx.js","sourceRoot":"","sources":["../../../../src/components/SiteMenu/MenuListItemButtonEx.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,2BAA2B,CAAA;AAMnF,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC7H,MAAM,
|
1
|
+
{"version":3,"file":"MenuListItemButtonEx.js","sourceRoot":"","sources":["../../../../src/components/SiteMenu/MenuListItemButtonEx.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,2BAA2B,CAAA;AAMnF,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC7H,MAAM,KAAK,GAAG,KAAK,CAAA;IACnB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACrG,6DAA6D;IAC7D,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAA;IACrE,6EAA6E;IAC7E,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAA;IACxD,OAAO,CACL,KAAC,gBAAgB,IAAC,EAAE,EAAE,EAAE,GAAG,gBAAgB,EAAE,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,EAAE,KAAM,KAAK,YACxF,QAAQ,GACQ,CACpB,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -16,11 +16,11 @@
|
|
16
16
|
"@xylabs/react-flexbox": "^2.14.20",
|
17
17
|
"@xylabs/react-link": "^2.14.20",
|
18
18
|
"@xylabs/react-shared": "^2.14.20",
|
19
|
-
"@xyo-network/react-app-settings": "^2.
|
20
|
-
"@xyo-network/react-archive": "^2.
|
21
|
-
"@xyo-network/react-auth-sets": "^2.
|
22
|
-
"@xyo-network/react-network": "^2.
|
23
|
-
"@xyo-network/react-shared": "^2.
|
19
|
+
"@xyo-network/react-app-settings": "^2.36.0",
|
20
|
+
"@xyo-network/react-archive": "^2.36.0",
|
21
|
+
"@xyo-network/react-auth-sets": "^2.36.0",
|
22
|
+
"@xyo-network/react-network": "^2.36.0",
|
23
|
+
"@xyo-network/react-shared": "^2.36.0",
|
24
24
|
"tslib": "^2.4.0"
|
25
25
|
},
|
26
26
|
"peerDependencies": {
|
@@ -31,6 +31,7 @@
|
|
31
31
|
"@xyo-network/payload": "*",
|
32
32
|
"react": "^18.2.0",
|
33
33
|
"react-dom": "^18.2.0",
|
34
|
+
"react-icons": "^4.4.0",
|
34
35
|
"react-router-dom": "^6.3.0"
|
35
36
|
},
|
36
37
|
"description": "Common React library for all XYO projects that use React",
|
@@ -76,5 +77,5 @@
|
|
76
77
|
},
|
77
78
|
"sideEffects": false,
|
78
79
|
"types": "dist/esm/index.d.ts",
|
79
|
-
"version": "2.
|
80
|
+
"version": "2.36.0"
|
80
81
|
}
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import
|
2
|
-
import { Divider, List, useTheme } from '@mui/material'
|
1
|
+
import { Divider, List, ListSubheader, useTheme } from '@mui/material'
|
3
2
|
import { ComponentMeta, ComponentStory, DecoratorFn } from '@storybook/react'
|
4
3
|
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
5
4
|
|
6
5
|
import { CollapsibleProvider, useCollapsible } from '../../contexts'
|
7
|
-
import { SiteMenuListItem
|
6
|
+
import { SiteMenuListItem } from '../SiteMenu'
|
8
7
|
import { CollapseToggleFlex } from './CollapseToggle'
|
9
8
|
import { CollapsibleDrawer } from './CollapsibleDrawer'
|
9
|
+
import { menuDataBottom, menuDataTop } from './ExampleMenuData'
|
10
10
|
|
11
11
|
const CollapseProviderDecorator: DecoratorFn = (Story, args) => {
|
12
12
|
return (
|
@@ -28,16 +28,6 @@ const StorybookEntry = {
|
|
28
28
|
title: 'appbar/CollapseDrawer',
|
29
29
|
} as ComponentMeta<typeof CollapsibleDrawer>
|
30
30
|
|
31
|
-
const SiteMenuList: React.FC<SiteMenuListItemProps> = (args) => {
|
32
|
-
return (
|
33
|
-
<List>
|
34
|
-
<SiteMenuListItem {...args} />
|
35
|
-
<SiteMenuListItem {...args} />
|
36
|
-
<SiteMenuListItem {...args} />
|
37
|
-
</List>
|
38
|
-
)
|
39
|
-
}
|
40
|
-
|
41
31
|
const Template: ComponentStory<typeof CollapsibleDrawer> = (args) => {
|
42
32
|
const { collapse, setCollapseEnd, collapseEnd } = useCollapsible()
|
43
33
|
const theme = useTheme()
|
@@ -45,7 +35,20 @@ const Template: ComponentStory<typeof CollapsibleDrawer> = (args) => {
|
|
45
35
|
<>
|
46
36
|
<FlexGrowCol alignItems="start" height="calc(100vh - 2rem)">
|
47
37
|
<CollapsibleDrawer in={!collapse} orientation="horizontal" collapsedSize={theme.spacing(5)} onExited={() => setCollapseEnd?.(true)} {...args}>
|
48
|
-
<
|
38
|
+
<List>
|
39
|
+
{collapseEnd ? null : <ListSubheader>Explore & Create</ListSubheader>}
|
40
|
+
{menuDataTop.map((item, index) => (
|
41
|
+
<>
|
42
|
+
<SiteMenuListItem key={index} {...item}></SiteMenuListItem>
|
43
|
+
</>
|
44
|
+
))}
|
45
|
+
{collapseEnd ? null : <ListSubheader>Settings & Analytics</ListSubheader>}
|
46
|
+
{menuDataBottom.map((item, index) => (
|
47
|
+
<>
|
48
|
+
<SiteMenuListItem key={index} {...item}></SiteMenuListItem>
|
49
|
+
</>
|
50
|
+
))}
|
51
|
+
</List>
|
49
52
|
<FlexGrowCol />
|
50
53
|
<CollapseToggleFlex justifyContent="start" />
|
51
54
|
</CollapsibleDrawer>
|
@@ -56,7 +59,9 @@ const Template: ComponentStory<typeof CollapsibleDrawer> = (args) => {
|
|
56
59
|
}
|
57
60
|
|
58
61
|
const Default = Template.bind({})
|
59
|
-
Default.args = {
|
62
|
+
Default.args = {
|
63
|
+
collapsedSize: '40px',
|
64
|
+
}
|
60
65
|
|
61
66
|
export { Default }
|
62
67
|
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import {
|
2
|
+
VscAccount,
|
3
|
+
VscGlobe,
|
4
|
+
VscGraph,
|
5
|
+
VscGraphLine,
|
6
|
+
VscJson,
|
7
|
+
VscServer,
|
8
|
+
VscSettingsGear,
|
9
|
+
VscSymbolMethod,
|
10
|
+
VscSymbolNamespace,
|
11
|
+
} from 'react-icons/vsc'
|
12
|
+
|
13
|
+
import { SiteMenuListItemProps } from '../SiteMenu'
|
14
|
+
|
15
|
+
export const menuDataTop: SiteMenuListItemProps[] = [
|
16
|
+
{
|
17
|
+
icon: <VscGlobe />,
|
18
|
+
primary: 'Explore',
|
19
|
+
subNavListItems: [{ primary: 'Explore', to: '', tooltip: 'View global archivist data on a world map.' }],
|
20
|
+
to: '',
|
21
|
+
tooltip: 'View global archivist data on a world map.',
|
22
|
+
},
|
23
|
+
{
|
24
|
+
icon: <VscSymbolMethod />,
|
25
|
+
primary: 'Blocks',
|
26
|
+
to: '',
|
27
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
28
|
+
},
|
29
|
+
{
|
30
|
+
icon: <VscSymbolNamespace />,
|
31
|
+
primary: 'Payloads',
|
32
|
+
to: '',
|
33
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
icon: <VscGraph />,
|
37
|
+
primary: 'Queries',
|
38
|
+
to: '',
|
39
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
40
|
+
},
|
41
|
+
{
|
42
|
+
icon: <VscServer />,
|
43
|
+
primary: 'Archives',
|
44
|
+
to: '',
|
45
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
46
|
+
},
|
47
|
+
]
|
48
|
+
|
49
|
+
export const menuDataBottom: SiteMenuListItemProps[] = [
|
50
|
+
{
|
51
|
+
icon: <VscGraphLine />,
|
52
|
+
primary: 'Statistics',
|
53
|
+
to: '',
|
54
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
55
|
+
},
|
56
|
+
{
|
57
|
+
icon: <VscJson />,
|
58
|
+
primary: 'Schema',
|
59
|
+
to: '',
|
60
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
61
|
+
},
|
62
|
+
{
|
63
|
+
icon: <VscAccount />,
|
64
|
+
primary: 'Account',
|
65
|
+
to: '',
|
66
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
67
|
+
},
|
68
|
+
{
|
69
|
+
icon: <VscSettingsGear />,
|
70
|
+
primary: 'Settings',
|
71
|
+
to: '',
|
72
|
+
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
73
|
+
},
|
74
|
+
]
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import PublicRoundedIcon from '@mui/icons-material/PublicRounded'
|
2
1
|
import { List } from '@mui/material'
|
3
2
|
import { ComponentMeta, ComponentStory } from '@storybook/react'
|
3
|
+
import { FaGlobeAmericas } from 'react-icons/fa'
|
4
4
|
|
5
5
|
import { SiteMenuListItem, SiteMenuListItemProps } from './MenuItems'
|
6
6
|
|
@@ -31,19 +31,18 @@ const Template: ComponentStory<typeof SiteMenuListItem> = (args) => {
|
|
31
31
|
|
32
32
|
const Default = Template.bind({})
|
33
33
|
Default.args = {
|
34
|
-
|
35
|
-
|
34
|
+
dense: true,
|
35
|
+
icon: <FaGlobeAmericas />,
|
36
|
+
primary: 'Explore',
|
37
|
+
tooltip: 'View global archivist data on a world map.',
|
36
38
|
}
|
37
39
|
|
38
40
|
const WithChildren = Template.bind({})
|
39
41
|
WithChildren.args = {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
),
|
45
|
-
icon: <PublicRoundedIcon />,
|
46
|
-
primary: 'Test',
|
42
|
+
icon: <FaGlobeAmericas />,
|
43
|
+
primary: 'Explore',
|
44
|
+
subNavListItems: [{ primary: 'Explore', to: '/explore', tooltip: 'View global archivist data on a world map.' }],
|
45
|
+
tooltip: 'View global archivist data on a world map.',
|
47
46
|
}
|
48
47
|
|
49
48
|
export { Default, WithChildren }
|
@@ -1,6 +1,8 @@
|
|
1
|
-
import { ListItemProps, ListItemTextProps } from '@mui/material'
|
1
|
+
import { Collapse, IconButton, List, ListItemProps, ListItemTextProps, Tooltip, useTheme } from '@mui/material'
|
2
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
2
3
|
import { ListItemButtonExProps } from '@xyo-network/react-shared'
|
3
|
-
import { ReactNode } from 'react'
|
4
|
+
import { ReactNode, useState } from 'react'
|
5
|
+
import { VscChevronDown, VscInfo } from 'react-icons/vsc'
|
4
6
|
import { To } from 'react-router-dom'
|
5
7
|
|
6
8
|
import { SiteMenuListItemBase } from './lib'
|
@@ -12,14 +14,29 @@ import { MenuListItemText } from './MenuListItemText'
|
|
12
14
|
export interface SiteMenuListItemProps extends SiteMenuListItemBase, ListItemProps {
|
13
15
|
primary: ListItemTextProps['primary']
|
14
16
|
to?: To
|
17
|
+
href?: string
|
15
18
|
icon?: ReactNode
|
16
19
|
onButtonClick?: ListItemButtonExProps['onClick']
|
20
|
+
subNavListItems?: SubNavListItemProps[]
|
21
|
+
tooltip?: string
|
22
|
+
small?: boolean
|
23
|
+
}
|
24
|
+
|
25
|
+
export interface SubNavListItemProps {
|
26
|
+
primary: ListItemTextProps['primary']
|
27
|
+
to?: To
|
28
|
+
href?: string
|
29
|
+
icon?: ReactNode
|
30
|
+
onButtonClick?: ListItemButtonExProps['onClick']
|
31
|
+
tooltip?: string
|
17
32
|
}
|
18
33
|
|
19
34
|
export const SiteMenuListItem: React.FC<SiteMenuListItemProps> = ({
|
20
35
|
style,
|
21
|
-
|
36
|
+
subNavListItems,
|
22
37
|
iconOnly,
|
38
|
+
tooltip,
|
39
|
+
small,
|
23
40
|
collapseEnd,
|
24
41
|
icon,
|
25
42
|
primary,
|
@@ -28,13 +45,59 @@ export const SiteMenuListItem: React.FC<SiteMenuListItemProps> = ({
|
|
28
45
|
...props
|
29
46
|
}) => {
|
30
47
|
const { dense } = props
|
48
|
+
const theme = useTheme()
|
49
|
+
const [openSubNav, setOpenSubNav] = useState(false)
|
50
|
+
const [hovered, setHovered] = useState(false)
|
31
51
|
return (
|
32
|
-
<MenuListItem
|
33
|
-
|
34
|
-
|
35
|
-
|
52
|
+
<MenuListItem
|
53
|
+
disableGutters
|
54
|
+
style={{ whiteSpace: 'nowrap', ...style }}
|
55
|
+
iconOnly={iconOnly}
|
56
|
+
onMouseEnter={() => setHovered(true)}
|
57
|
+
onMouseLeave={() => setHovered(false)}
|
58
|
+
{...props}
|
59
|
+
>
|
60
|
+
<MenuListItemButtonEx
|
61
|
+
iconOnly={iconOnly}
|
62
|
+
onClick={onButtonClick}
|
63
|
+
collapseEnd={collapseEnd}
|
64
|
+
dense={dense}
|
65
|
+
to={to}
|
66
|
+
sx={{ justifyContent: 'space-between' }}
|
67
|
+
>
|
68
|
+
<FlexRow>
|
69
|
+
<MenuIcon
|
70
|
+
icon={icon}
|
71
|
+
fontSize={small ? '14px' : '16px'}
|
72
|
+
paddingRight={theme.spacing(1)}
|
73
|
+
color={hovered ? theme.palette.primary.main : 'inherit'}
|
74
|
+
/>
|
75
|
+
<MenuListItemText primary={primary} iconOnly={iconOnly} sx={{ fontSize: small ? theme.typography.caption.fontSize : '' }} />
|
76
|
+
</FlexRow>
|
77
|
+
<FlexRow>
|
78
|
+
{subNavListItems ? (
|
79
|
+
<IconButton onClick={() => setOpenSubNav(!openSubNav)} sx={{ marginRight: theme.spacing(1) }}>
|
80
|
+
<VscChevronDown fontSize={small ? '14px' : '16px'} />
|
81
|
+
</IconButton>
|
82
|
+
) : null}
|
83
|
+
{tooltip ? (
|
84
|
+
<Tooltip title={tooltip} placement="right">
|
85
|
+
<div>
|
86
|
+
<VscInfo color="disabled" />
|
87
|
+
</div>
|
88
|
+
</Tooltip>
|
89
|
+
) : null}
|
90
|
+
</FlexRow>
|
36
91
|
</MenuListItemButtonEx>
|
37
|
-
{
|
92
|
+
{subNavListItems && !iconOnly ? (
|
93
|
+
<Collapse in={openSubNav}>
|
94
|
+
<List>
|
95
|
+
{subNavListItems.map((item, index) => {
|
96
|
+
return <SiteMenuListItem key={index} {...item} />
|
97
|
+
})}
|
98
|
+
</List>
|
99
|
+
</Collapse>
|
100
|
+
) : null}
|
38
101
|
</MenuListItem>
|
39
102
|
)
|
40
103
|
}
|
@@ -5,7 +5,7 @@ import { SiteMenuListItemBase } from './lib'
|
|
5
5
|
export interface MenuListItemButtonExProps extends SiteMenuListItemBase, ListItemButtonExProps {}
|
6
6
|
|
7
7
|
export const MenuListItemButtonEx: React.FC<MenuListItemButtonExProps> = ({ iconOnly, collapseEnd, sx, children, ...props }) => {
|
8
|
-
const
|
8
|
+
const dense = props
|
9
9
|
const listItemButtonSx = iconOnly ? { borderRadius: '50%', display: 'inline-flex', flexGrow: 0 } : {}
|
10
10
|
// wait till collapseEnds to remove the spacing between items
|
11
11
|
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 }
|