Skip to content
Permalink
Browse files

fix: add flip and forward popperConfig to DropdownMenu (#3318)

  • Loading branch information
jquense committed Oct 12, 2018
1 parent eb3e413 commit 0aa2de27751cdccaed99de28be83203dfb5fd1b2
Showing with 13 additions and 6 deletions.
  1. +13 −0 src/DropdownMenu.js
  2. +0 −6 yarn.lock
@@ -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,

@@ -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() {
@@ -59,6 +68,8 @@ class DropdownMenu extends React.Component {
className,
alignRight,
rootCloseEvent,
flip,
popperConfig,
show: showProps,
as: Component,
...props
@@ -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 }) => {
@@ -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"

0 comments on commit 0aa2de2

Please sign in to comment.
You can’t perform that action at this time.