-
-
Notifications
You must be signed in to change notification settings - Fork 150
/
MaterialNestedMenuList.js
183 lines (179 loc) · 4.3 KB
/
MaterialNestedMenuList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/* eslint-disable no-use-before-define */
import React from 'react';
import pick from 'lodash/pick';
import Box from '@material-ui/core/Box';
import NestedMenuList from '@mui-treasury/components/menuList/nested';
import { useMaterialNestedMenuStyles } from '@mui-treasury/styles/menuList/nested/material';
import { useMaterialActionToggleItemStyles } from '@mui-treasury/styles/menuItem/actionToggle/material';
import { useMaterialInfoMenuItemStyles } from '@mui-treasury/styles/menuItem/info/material';
const MaterialNestedMenuList = () => {
const nestedStyles = useMaterialNestedMenuStyles();
const actionToggleStyles = useMaterialActionToggleItemStyles();
const infoStyles = useMaterialInfoMenuItemStyles();
return (
<Box minWidth={256}>
<NestedMenuList
// you can set initial state with these props
// selectedKey={'awsS3'}
// initialOpenKeys={['refGuides', 'deployHosting']}
// ------------------------------------------------
classes={nestedStyles}
menus={getMenus()}
getParentProps={({ data }) => ({
children: data.label,
classes: actionToggleStyles,
listItemProps: {
className: nestedStyles.menuItem,
classes: pick(infoStyles, ['root', 'focusVisible']),
},
})}
getChildProps={({ data }) => ({
children: data.label,
classes: infoStyles,
infoClassName: infoStyles.info,
})}
/>
</Box>
);
};
const getMenus = () => [
{
key: 'intro',
label: 'Introduction',
},
{
key: 'quick start',
label: 'Quick Start',
},
{
key: 'recipes',
label: 'Recipes',
},
{
key: 'refGuides',
label: 'Reference Guides',
subMenus: [
{
key: 'preparingEnv',
label: 'Preparing Your Environment',
subMenus: [
{
key: 'browserSupport',
label: 'Browser Support',
},
{
key: 'gatsbyWindow',
label: 'Gatsby on Windows',
},
{
key: 'gatsbyLinux',
label: 'Gatsby on Linux',
},
],
},
{
key: 'deployHosting',
label: 'Deploying & Hosting',
subMenus: [
{
key: 'preparing',
label: 'Preparing a Site for Deployment',
},
{
key: 'awsAmplify',
label: 'Deploying to AWS Amplify',
},
{
key: 'awsS3',
label: 'Deploying to S3 and CloudFront',
},
],
},
{
key: 'customConfig',
label: 'Custom Configuration',
subMenus: [
{
key: 'babeljs',
label: 'Customizing Babel.js Config',
},
{
key: 'babelPluginMacro',
label: 'Using Babel Plugin Macros',
},
{
key: 'customWebpack',
label: 'Adding a Custom Webpack Config',
},
],
},
],
},
{
key: 'api',
label: 'Gatsby API',
subMenus: [
{
key: 'themes',
label: 'Gatsby Themes',
},
{
key: 'link',
label: 'Gatsby Link',
},
{
key: 'image',
label: 'Gatsby Image',
},
{
key: 'config',
label: 'Gatsby Config',
},
],
},
{
key: 'migration',
label: 'Releases & Migration',
subMenus: [
{
key: 'v2',
label: 'v2 Release Notes',
},
{
key: 'v1',
label: 'v1 Release Notes',
},
{
key: 'v1Tov2',
label: 'Migration from v1 to v2',
},
{
key: 'v0Tov1',
label: 'Migration from v0 to v1',
},
],
},
];
// hide-start
MaterialNestedMenuList.metadata = {
title: 'Material Nested',
path: 'menuList/nested/material',
files: [
{ pkg: 'mui-components', path: 'menuList/nested/NestedMenuList.js' },
{
pkg: 'mui-styles',
path: 'menuList/nested/material/materialNestedMenu.styles.js',
},
{
pkg: 'mui-styles',
path: 'menuItem/toggle/material/toggleMenuItem.styles.js',
},
{
pkg: 'mui-styles',
path: 'menuItem/info/material/infoMenuItem.styles.js',
},
],
relates: [],
};
// hide-end
export default MaterialNestedMenuList;