-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[New Menus] Nested Support #1517
Comments
+1 |
2 similar comments
+1 |
+1 |
@subjectix happy to close this |
@chrismcv can menus be nested now? I haven't had the time to tackle them. |
yeah - slipped that one in a while back. #2148 |
Oh, right. Nice work 👍 👍 |
@chrismcv What's a good way to mark a nested menu item as selected? Going for a LeftNav similar to the one on https://www.google.com/design/spec/components/subheaders.html#subheaders-menu-subheaders Happy to make a new issue if you think it's necessary. |
@STRML Having a look at your example, I think that a |
Thanks. It's a bit tricky to get working with nested menu(items, styles, nestedLevel=0) {
return (
<SelectableList
autoWidth={false}
desktop={true}
valueLink={{value: this.state.activeRoute, requestChange: this.handleUpdateRoute}}
openDirection="bottom-right"
style={nestedLevel === 0 ? styles.secondaryNav : {}}
value={this.state.activeRoute}
width={styles.secondaryNav.width}
selectedItemStyle={{
color: this.context.muiTheme.rawTheme.palette.accent1Color,
}}
zDepth={0}>
{_.flatten(items.map((item, index) =>
this.menuItem(item, index, styles, nestedLevel)))}
</SelectableList>
);
},
menuItem(item, index, styles, nestedLevel) {
if (item.divider) return <Divider key={index} />;
let out = [
<ListItem
key={index}
primaryText={item.text}
data-route={item.route}
value={item.route}
onTouchTap={this.onItemTouchTap}
initiallyOpen={true}
desktop={true}
autoGenerateNestedIndicator={false}
nestedLevel={nestedLevel}
/>
];
if (item.nested) {
out.push(this.menu(item.nested, styles, nestedLevel + 1));
}
return out;
},
render() {
let styles = this.getStyles();
const menuItems = [
{route: '/a', text: 'Item A', nested: [
{route: '/a_a', text: 'Nested Item A'}
{route: '/a_b', text: 'Nested Item B'}
]},
{route: '/B', text: 'Item B'},
{divider: true},
{route: '/C', text: 'Item C'},
];
return this.menu(menuItems, styles);
} |
I'm happy you found a solution, and thanks for sharing that may help other 👍. Is the |
Thanks - you're correct, the |
* Remvoe focusRipple and better selected + focus state managment * Do not show outline on touch devices * Do not focus current day and year by default in static mode * Render better date for placeholder by default
Hi,
Just wondering what the status of nested support is with new menus - the ListItem being used seems to support some variation of this, but it doesn't look menu friendly - it just indents.
What is needs done to support this? Happy to help.
Chris
The text was updated successfully, but these errors were encountered: