Skip to content

Commit

Permalink
fix: action panel to render as a body direct child
Browse files Browse the repository at this point in the history
  • Loading branch information
pphminions committed Jul 15, 2019
1 parent 28d5156 commit c4abbdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/adslot-ui/ActionPanel/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import ReactDOM from 'react-dom';
import Button from 'react-bootstrap/lib/Button';
import './styles.scss';

Expand All @@ -15,7 +16,8 @@ class ActionPanel extends React.PureComponent {

render() {
const { title, className, size, onClose, children, actionButton, isModal, closeIcon } = this.props;
return (

const actionPanel = (
<React.Fragment>
<div className={isModal ? 'aui--action-panel-backdrop' : 'hide'} />
<div className={classNames('aui--action-panel-wrapper', { 'aui--action-panel-modal-wrapper': isModal })}>
Expand All @@ -38,6 +40,8 @@ class ActionPanel extends React.PureComponent {
</div>
</React.Fragment>
);

return isModal ? ReactDOM.createPortal(actionPanel, document.body) : actionPanel;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/components/adslot-ui/ActionPanel/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
z-index: $zindex-popover;
border: $border-lighter;
border-radius: 2px;
background-color: $color-white;

&.action-modal {
top: 30px;
Expand Down

0 comments on commit c4abbdc

Please sign in to comment.