Skip to content

Commit

Permalink
Refactor #1917 - For SlideMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 12, 2021
1 parent 99772ff commit 57d69db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/slidemenu/SlideMenu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface SlideMenuProps {
autoZIndex?: boolean;
baseZIndex?: 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/slidemenu/SlideMenu.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 ObjectUtils from '../utils/ObjectUtils';
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 Down Expand Up @@ -173,6 +173,7 @@ export class SlideMenu extends Component {
autoZIndex: true,
baseZIndex: 0,
appendTo: null,
transitionOptions: null,
onShow: null,
onHide: null
}
Expand All @@ -191,6 +192,7 @@ export class SlideMenu extends Component {
autoZIndex: PropTypes.bool,
baseZIndex: PropTypes.number,
appendTo: PropTypes.any,
transitionOptions: PropTypes.object,
onShow: PropTypes.func,
onHide: PropTypes.func
}
Expand Down Expand Up @@ -384,7 +386,7 @@ export class SlideMenu extends Component {
const backward = this.renderBackward();

return (
<CSSTransition nodeRef={this.menuRef} classNames="p-connected-overlay" in={!this.props.popup || this.state.visible} timeout={{ enter: 120, exit: 100 }}
<CSSTransition nodeRef={this.menuRef} classNames="p-connected-overlay" in={!this.props.popup || 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}>
<div className="p-slidemenu-wrapper" style={{ height: this.props.viewportHeight + 'px' }}>
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/slidemenu/SlideMenuDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,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 57d69db

Please sign in to comment.