Skip to content

Commit

Permalink
fix: add flip and forward popperConfig to DropdownMenu (#3318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Oct 12, 2018
1 parent eb3e413 commit 0aa2de2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 13 additions & 0 deletions src/DropdownMenu.js
Expand Up @@ -24,6 +24,9 @@ class DropdownMenu extends React.Component {
/** Controls the visibility of the Dropdown menu */
show: PropTypes.bool,

/** Have the dropdown switch to it's opposite placement when necessary to stay on screen. */
flip: PropTypes.bool,

/** Aligns the Dropdown menu to the right of it's container. */
alignRight: PropTypes.bool,

Expand All @@ -46,11 +49,17 @@ class DropdownMenu extends React.Component {
* are also injected and should be handled appropriatedly.
*/
as: elementType,

/**
* A set of popper options and props passed directly to react-popper's Popper component.
*/
popperConfig: PropTypes.object,
};

static defaultProps = {
alignRight: false,
as: 'div',
flip: true,
};

render() {
Expand All @@ -59,6 +68,8 @@ class DropdownMenu extends React.Component {
className,
alignRight,
rootCloseEvent,
flip,
popperConfig,
show: showProps,
as: Component,
...props
Expand All @@ -68,9 +79,11 @@ class DropdownMenu extends React.Component {
<NavbarContext>
{isNavbar => (
<BaseDropdownMenu
flip={flip}
show={showProps}
alignEnd={alignRight}
usePopper={!isNavbar}
popperConfig={popperConfig}
rootCloseEvent={rootCloseEvent}
>
{({ placement, show, alignEnd, close, props: menuProps }) => {
Expand Down
6 changes: 0 additions & 6 deletions yarn.lock
Expand Up @@ -373,12 +373,6 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"

"@babel/plugin-syntax-dynamic-import@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0.tgz#6dfb7d8b6c3be14ce952962f658f3b7eb54c33ee"
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"

"@babel/plugin-syntax-export-default-from@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.0.0.tgz#084b639bce3d42f3c5bf3f68ccb42220bb2d729d"
Expand Down

0 comments on commit 0aa2de2

Please sign in to comment.