Skip to content

Commit

Permalink
use portal on bottom bar, fixes elastic#49
Browse files Browse the repository at this point in the history
  • Loading branch information
snide committed Mar 9, 2018
1 parent c258cf3 commit 677749d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/bottom_bar/bottom_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import { EuiPortal } from '../portal'

const paddingSizeToClassNameMap = {
none: null,
s: 'euiBottomBar--paddingSmall',
Expand All @@ -24,12 +26,14 @@ export const EuiBottomBar = ({
);

return (
<div
className={classes}
{...rest}
>
{children}
</div>
<EuiPortal>
<div
className={classes}
{...rest}
>
{children}
</div>
</EuiPortal>
);
};

Expand Down
6 changes: 6 additions & 0 deletions src/components/bottom_bar/bottom_bar.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { render } from 'enzyme';
import { requiredProps } from '../../test/required_props';

import { EuiBottomBar, PADDING_SIZES } from './bottom_bar';


// TODO: Temporary hack which we can remove once react-test-renderer supports portals.
// More info at https://github.com/facebook/react/issues/11565.
ReactDOM.createPortal = node => node;

describe('EuiBottomBar', () => {
test('is rendered', () => {
const component = render(
Expand Down

0 comments on commit 677749d

Please sign in to comment.