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

fix(PopupMenu): add prop popupMenuDropdownClassName #495

Merged
merged 2 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/popup-menu/popup-menu-list.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Children, Component, cloneElement } from 'react';
import cn from 'classnames';
import PropTypes from 'prop-types';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
import keyCodes from './keyCodes';
Expand Down Expand Up @@ -69,14 +70,14 @@ class PopupMenuList extends Component {
};

render() {
const { width, classes, children, enter, exit, maxHeight, isOpen, 'aria-labelledby': ariaLabelledBy } = this.props;
const { width, classes, children, enter, exit, maxHeight, isOpen, 'aria-labelledby': ariaLabelledBy, className } = this.props;
const itemContainerStyle = maxHeight === 'none' ? {} : { maxHeight, overflowY: 'scroll' };
let notDisabledIndex = 0;
return (
<TransitionGroup>
{isOpen && (
<CSSTransition classNames={classes.menuSlideDown} timeout={{ exit, enter }}>
<div className={classes.menuPopup} style={{ width }}>
<div className={cn(classes.menuPopup, className)} style={{ width }}>
<div className={classes.menuItemContainer} style={itemContainerStyle}>
<ul className={classes.menuItems} aria-labelledby={ariaLabelledBy} ref={this.setListElement} onBlur={this.onBlur}>
{Children.map(children, child => {
Expand Down Expand Up @@ -112,6 +113,7 @@ PopupMenuList.propTypes = {
enter: PropTypes.number.isRequired,
exit: PropTypes.number.isRequired,
maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
className: PropTypes.string,
};

export default PopupMenuList;
3 changes: 3 additions & 0 deletions src/components/popup-menu/popup-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class PopupMenu extends Component {
toggleButton,
classes,
className,
popupMenuDropdownClassName,
children,
enter,
exit,
Expand Down Expand Up @@ -134,6 +135,7 @@ class PopupMenu extends Component {
<PopupMenuList
aria-labelledby={id}
classes={classes}
className={popupMenuDropdownClassName}
isOpen={open}
onBlur={this.onBlurList}
onKeyDown={this.onKeyDown}
Expand All @@ -159,6 +161,7 @@ PopupMenu.propTypes = {
isOpen: PropTypes.bool,
classes: PropTypes.object.isRequired,
className: PropTypes.string,
popupMenuDropdownClassName: PropTypes.string,
onToggle: PropTypes.func,
/**
* The aria-label for the toggle button. Either a plain string or an object with different labels
Expand Down
2 changes: 1 addition & 1 deletion src/components/popup-menu/popup-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { HashRouter, Link } = require('../../../node_modules/react-router-dom');
<HashRouter>
<div style={{display: 'flex', marginLeft: 200}}>
<PopupMenu buttonLabel={{ open: 'Open menu', close: 'Close menu'}} buttonID="PopupMenu">
<PopupMenu buttonLabel={{ open: 'Open menu', close: 'Close menu'}} buttonID="PopupMenu" popupMenuClassName={"testClass"}>
<PopupMenuItem disabled node={Link}>
Disabled link
</PopupMenuItem>
Expand Down