var React = require('react');
var Mui = require('material-ui');
var Paper = Mui.Paper;
var Dom = require('../../../../../node_modules/material-ui/lib/js/utils/dom');
var KeyLine = require('../../../../../node_modules/material-ui/lib/js/utils/key-line');
var MenuItem = require('./menu-item.jsx');
var RaisedButton = Mui.RaisedButton;
var Menu = React.createClass({
propTypes: {
autoWidth: React.PropTypes.bool,
onItemTap: React.PropTypes.func,
onItemClick: React.PropTypes.func,
onToggleClick: React.PropTypes.func,
menuItems: React.PropTypes.array.isRequired,
selectedIndex: React.PropTypes.number,
hideable: React.PropTypes.bool,
visible: React.PropTypes.bool,
zDepth: React.PropTypes.number
},
getInitialState: function() {
return { nestedMenuShown: false }
},
getDefaultProps: function() {
return {
autoWidth: true,
hideable: false,
visible: true,
zDepth: 1
};
},
componentDidMount: function() {
var el = this.getDOMNode();
//Set the menu with
this._setKeyWidth(el);
//Save the initial menu height for later
this._initialMenuHeight = el.offsetHeight + KeyLine.Desktop.GUTTER_LESS;
//Show or Hide the menu according to visibility
this._renderVisibility();
},
componentDidUpdate: function(prevProps, prevState) {
if (this.props.visible !== prevProps.visible) this._renderVisibility();
},
render: function() {
var classes = 'mui-menu';
if(this.props.hideable) {
classes += ' mui-menu-hideable';
}
if(this.props.visible) {
classes += ' mui-visible';
}
return (