Skip to content

Commit

Permalink
Refactor #1917 - For OverlayPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 12, 2021
1 parent 618b270 commit b5ba23a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/overlaypanel/OverlayPanel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface OverlayPanelProps {
appendTo?: HTMLElement;
ariaCloseLabel?: string;
breakpoints?: Breakpoints;
transitionOptions?: object;
onHide?(): void;
}

Expand Down
6 changes: 4 additions & 2 deletions src/components/overlaypanel/OverlayPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import { classNames } from '../utils/ClassNames';
import DomHandler from '../utils/DomHandler';
import { CSSTransition } from 'react-transition-group';
import { CSSTransition } from '../transition/CSSTransition';
import { Ripple } from '../ripple/Ripple';
import UniqueComponentId from '../utils/UniqueComponentId';
import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler';
Expand All @@ -21,6 +21,7 @@ export class OverlayPanel extends Component {
appendTo: null,
breakpoints: null,
ariaCloseLabel: 'close',
transitionOptions: null,
onHide: null
}

Expand All @@ -33,6 +34,7 @@ export class OverlayPanel extends Component {
appendTo: PropTypes.any,
breakpoints: PropTypes.object,
ariaCloseLabel: PropTypes.string,
transitionOptions: PropTypes.object,
onHide: PropTypes.func
}

Expand Down Expand Up @@ -279,7 +281,7 @@ export class OverlayPanel extends Component {
let closeIcon = this.renderCloseIcon();

return (
<CSSTransition nodeRef={this.overlayRef} classNames="p-overlaypanel" in={this.state.visible} timeout={{ enter: 120, exit: 100 }}
<CSSTransition nodeRef={this.overlayRef} classNames="p-overlaypanel" 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.overlayRef} id={this.props.id} className={className} style={this.props.style} onClick={this.onPanelClick}>
<div className="p-overlaypanel-content">
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/overlaypanel/OverlayPanelDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ import { OverlayPanel } from 'primereact/overlaypanel';
<td>null</td>
<td>Object literal to define widths per screen size.</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 b5ba23a

Please sign in to comment.