Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
feat(OverflowMenu): add menuOptionsClass to overflowMenu (#2174)
Browse files Browse the repository at this point in the history
* feat: add menuOptionsClass to overflowMenu

* refactor: use the destructured prop
  • Loading branch information
ashharrison90 authored and tw15egan committed Apr 10, 2019
1 parent e769f33 commit 3f7e44e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/OverflowMenu/OverflowMenu-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('OverflowMenu', () => {

it('should render a ul with the appropriate class', () => {
const rootWrapper = mount(
<OverflowMenu>
<OverflowMenu menuOptionsClass="extra-menu-class">
<div className="test-child" />
<div className="test-child" />
</OverflowMenu>
Expand All @@ -124,6 +124,7 @@ describe('OverflowMenu', () => {
const list = rootWrapper.find('ul');
expect(list.length).toEqual(1);
expect(list.hasClass('bx--overflow-menu-options')).toEqual(true);
expect(list.hasClass('extra-menu-class')).toEqual(true);
});

it('should render children as expected', () => {
Expand Down
7 changes: 7 additions & 0 deletions src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ class OverflowMenu extends Component {
*/
onClose: PropTypes.func,

/**
* The class to apply to the menu options
*/
menuOptionsClass: PropTypes.string,

/**
* Function called when menu is closed
*/
Expand Down Expand Up @@ -577,6 +582,7 @@ class OverflowMenu extends Component {
onOpen, // eslint-disable-line
renderIcon: IconElement,
innerRef: ref,
menuOptionsClass,
...other
} = this.props;
const floatingMenu = !!breakingChangesX || origFloatingMenu;
Expand Down Expand Up @@ -613,6 +619,7 @@ class OverflowMenu extends Component {
);

const overflowMenuOptionsClasses = classNames(
menuOptionsClass,
`${prefix}--overflow-menu-options`,
{
[`${prefix}--overflow-menu--flip`]: this.props.flipped,
Expand Down

0 comments on commit 3f7e44e

Please sign in to comment.