Skip to content

Instantly share code, notes, and snippets.

@jquense
Created March 15, 2016 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jquense/c619a10219e5b22c48de to your computer and use it in GitHub Desktop.
Save jquense/c619a10219e5b22c48de to your computer and use it in GitHub Desktop.
import React from 'react';
import cn from 'classnames';
import RootCloseWrapper from 'react-overlays/lib/RootCloseWrapper';
let MenuPanel = React.createClass({
getDefaultProps(){
return {
bsRole: 'menu',
rootClose: true
}
},
render() {
let { rootClose, open } = this.props;
let { pullRight, pullUp } = this.state
, style;
if (pullUp)
style = { top: 'auto', bottom: '100%'}
let menu = (
<div {...this.props}
style={{
...style,
maxHeight: 'none',
width: 'auto',
overflow: 'visible',
...this.props.style
}}
className={cn('dropdown-menu', {
'dropdown-menu-right': pullRight || this.props.pullRight
})}
onSelect={undefined}
>
{ this.props.children }
</div>
);
if (rootClose && open)
return <RootCloseWrapper noWrap onRootClose={this.props.onClose}>{menu}</RootCloseWrapper>
return menu
}
})
export default MenuPanel;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment