Skip to content

Commit

Permalink
Refactor #1917 - For TieredMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 12, 2021
1 parent 44ebc12 commit 2db3658
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/tieredmenu/TieredMenu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface TieredMenuProps {
autoZIndex?: boolean;
bazeZIndex?: number;
appendTo?: HTMLElement;
transitionOptions?: object;
onShow?(e: React.SyntheticEvent): void;
onHide?(e: React.SyntheticEvent): void;
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/tieredmenu/TieredMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { classNames } from '../utils/ClassNames';
import DomHandler from '../utils/DomHandler';
import { TieredMenuSub } from './TieredMenuSub';
import { CSSTransition } from 'react-transition-group';
import { CSSTransition } from '../transition/CSSTransition';
import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler';
import OverlayEventBus from '../overlayeventbus/OverlayEventBus';
import { Portal } from '../portal/Portal';
Expand All @@ -20,6 +20,7 @@ export class TieredMenu extends Component {
autoZIndex: true,
baseZIndex: 0,
appendTo: null,
transitionOptions: null,
onShow: null,
onHide: null
};
Expand All @@ -33,6 +34,7 @@ export class TieredMenu extends Component {
autoZIndex: PropTypes.bool,
baseZIndex: PropTypes.number,
appendTo: PropTypes.any,
transitionOptions: PropTypes.object,
onShow: PropTypes.func,
onHide: PropTypes.func
};
Expand Down Expand Up @@ -193,7 +195,7 @@ export class TieredMenu extends Component {
const className = classNames('p-tieredmenu p-component', { 'p-tieredmenu-overlay': this.props.popup }, this.props.className);

return (
<CSSTransition nodeRef={this.menuRef} classNames="p-connected-overlay" in={this.state.visible} timeout={{ enter: 120, exit: 100 }}
<CSSTransition nodeRef={this.menuRef} classNames="p-connected-overlay" in={this.state.visible} timeout={{ enter: 120, exit: 100 }} options={this.props.transitionOptions}
unmountOnExit onEnter={this.onEnter} onEntered={this.onEntered} onExit={this.onExit} onExited={this.onExited}>
<div ref={this.menuRef} id={this.props.id} className={className} style={this.props.style} onClick={this.onPanelClick}>
<TieredMenuSub model={this.props.model} root popup={this.props.popup} />
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/tieredmenu/TieredMenuDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,12 @@ const items = [
<td>document.body</td>
<td>DOM element instance where the overlay menu should be mounted.</td>
</tr>
<tr>
<td>transitionOptions</td>
<td>object</td>
<td>null</td>
<td>The properties of <a href="https://reactcommunity.org/react-transition-group/css-transition" rel="noopener noreferrer" target="_blank">CSSTransition</a> can be customized, except for "nodeRef" and "in" properties.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 2db3658

Please sign in to comment.