From 279a595eac532495d9bc75e597b64b3a72641473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Maro=C5=A1i?= Date: Fri, 18 Jan 2019 22:05:00 +0100 Subject: [PATCH] fix(DropdownMenu): Fixes dropdown menu when using items as children. (#1219) fix 1218 --- .../src/components/Dropdown/DropdownMenu.js | 60 +++++++++---------- .../__snapshots__/Dropdown.test.js.snap | 38 +++++++----- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/DropdownMenu.js b/packages/patternfly-4/react-core/src/components/Dropdown/DropdownMenu.js index 175bc09ff0b..b5ea4d554ec 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/DropdownMenu.js +++ b/packages/patternfly-4/react-core/src/components/Dropdown/DropdownMenu.js @@ -118,34 +118,31 @@ class DropdownMenu extends React.Component { render() { const { className, isOpen, position, children, component: Component, openedOnEnter, ...props } = this.props; - let menu = null; - if (Component === 'div') { - menu = ( - - {onSelect => ( - - )} - - ); - } else if (Component === 'ul') { - menu = ( - + + return ( + + {Component === 'div' ? ( + + {onSelect => ( + + )} + + ) : ( {this.extendChildren()} - - ); - } - return menu; + )} + + ); } } diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap index 1408e09d716..54745c71d8e 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap @@ -145,21 +145,24 @@ exports[`KebabToggle basic 1`] = ` isOpen={true} position="left" > - + @@ -1966,21 +1969,24 @@ exports[`dropdown basic 1`] = ` isOpen={true} position="left" > - +